SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.09262 · 2021

TOGA: A Neural Method for Test Oracle Generation

arXiv · PDF · Open in the Atlas

Code that ran

18 of 22 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 16 have no contract verdict; 1 failure of our instrument; 4 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2109.09262.json · badge: /api/ran/2109.09262.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
microsoft/toga canonical (classifier label)
classifier basis: census
18 ran · 4 no recorded run
FunctionStatusWhere it lives
acc_and_f1 Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
microsoft/toga/model/assertions/utils.py
code served (permissive licence) · get_code("15b03d85dc1e5392")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from sklearn.metrics import f1_score

torch.manual_seed(0)

# Create small prediction and label arrays
# Using numpy arrays as the function uses them with == comparison and .mean()
preds = np.array([0, 1, 1, 0, 1])
labels = np.array([0, 1, 0, 0, 1])

ARGS = {
    'preds': preds,
    'labels': labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
accuracy Ran
ran, honoured the contract we drafted
microsoft/toga/model/assertions/run_classifier.py
code served (permissive licence) · get_code("eb725d5794b15f6b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned int64, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create sample outputs from a model (e.g., logits for 2 samples, 5 classes)
out = np.array([
    [0.1, 0.3, 0.8, 0.2, 0.1],  # argmax = 2
    [0.9, 0.1, 0.2, 0.3, 0.05]  # argmax = 0
])

# Create corresponding labels
labels = np.array([2, 0])

ARGS = {
    'out': out,
    'labels': labels
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int64, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
bool_assert_to_equals Ran
ran on a synthesized input
microsoft/toga/eval/gen_tests_from_metadata.py
code served (permissive licence) · get_code("8efa0e429d75adda")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function takes a single parameter: assertion
# It processes a string that should contain either 'assertTrue' or similar assertion syntax
# It uses: .strip(), string operations (find, rfind), string slicing
# Example assertions: "assertTrue(some_condition)" or "assertFalse(some_condition)"

ARGS = {
    'assertion': '  assertTrue(x > 5)  '
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
clean Ran
ran on a synthesized input
microsoft/toga/model/exception_data.py
code served (permissive licence) · get_code("264bcac39d00a4e1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

whitespace_re = re.compile('\\s+')

def clean(code):
    return whitespace_re.sub(' ', code).strip()

# Construct valid arguments for the clean function
# The function takes a single parameter 'code' which should be a string
# It removes extra whitespace and strips leading/trailing whitespace

ARGS = {
    'code': '  def   hello(  ):  \n\t  pass  \n  '
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
convert_examples_to_features Ran
ran on a synthesized input
microsoft/toga/model/assertions/utils.py
code served (permissive licence) · get_code("95c91a2b77c7fb96")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import logging
import numpy as np
from copy import deepcopy

logging.basicConfig(level=logging.INFO)

class MockTokenizer:
    """Stand-in tokenizer with required methods."""
    
    def tokenize(self, text):
        """Splits text into tokens."""
        if text is None:
            return []
        return text.split()
    
    def convert_tokens_to_ids(self, tokens):
        """Converts tokens to token IDs."""
        # Simple mapping: each token gets a unique ID
        token_to_id = {token: idx for idx, token in enumerate(set(tokens))}
        return [token_to_id.get(token, 0) for token in tokens]


class MockExample:
    """Stand-in example with required attributes."""
    
    def __init__(self, guid, text_a, text_b=None, text_c=None, label=None):
        self.guid = guid
        self.text_a = text_a
        self.text_b = text_b
        self.text_c = text_c
        self.label = label


# Create mock examples
examples = [
    MockExample(
        guid="example_0",
        text_a="this is a sample text for testing",
        text_b="this is another text",
        text_c="and a third text",
        label="positive"
    ),
    MockExample(
        guid="example_1",
        text_a="another example with different content",
        text_b="more text here",
        text_c="final piece of text",
        label="negative"
    ),
]

# Label list for classification
label_list = ["positive", "negative"]

# Tokenizer
tokenizer = MockTokenizer()

# Parameters
ARGS = {
    "examples": examples,
    "label_list": label_list,
    "max_seq_length": 128,
    "tokenizer": tokenizer,
    "output_mode": "classification",
    "cls_token_at_end": False,
    "pad_on_left": False,
    "cls_token": "[CLS]",
    "sep_token": "[SEP]",
    "pad_token": 0,
    "sequence_a_segment_id": 0,
    "sequence_b_segment_id": 1,
    "cls_token_segment_id": 1,
    "pad_token_segment_id": 0,
    "mask_padding_with_zero": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
diff Ran
ran on a synthesized input
microsoft/toga/model/ranking.py
code served (permissive licence) · get_code("9a5769855cf4c041")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function diff(x, y) computes abs(x - y)
# It takes two numeric arguments that support subtraction and abs()
# These can be integers, floats, or tensors

x = torch.tensor(5.0)
y = torch.tensor(3.0)

ARGS = {
    "x": x,
    "y": y
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_active_bugs Ran
ran on a synthesized input
microsoft/toga/eval/collect_test_results.py
code served (permissive licence) · get_code("f052c69e11bdefba")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import pandas as pd
import tempfile
import os

# Create a temporary directory to serve as d4j_project_dir
temp_dir = tempfile.mkdtemp()

# Create a minimal active-bugs.csv file with the required columns
csv_data = pd.DataFrame({
    'revision.id.buggy': ['abc123', 'def456', 'ghi789'],
    'revision.id.fixed': ['abc124', 'def457', 'ghi790']
}, index=['bug_1', 'bug_2', 'bug_3'])

csv_path = os.path.join(temp_dir, 'active-bugs.csv')
csv_data.to_csv(csv_path)

ARGS = {
    'd4j_project_dir': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_block Ran
ran on a synthesized input
microsoft/toga/model/exception_data.py
code served (permissive licence) · get_code("bd5b0111e170a7f5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import re

# Construct valid arguments for get_block function
test_1 = "some_function( () -> result_block )"
start_call_1 = "some_function"

test_2 = "another_function( MyClass::my_method )"
start_call_2 = "another_function"

test_3 = "process( () -> extracted_content )"
start_call_3 = "process"

# The function uses:
# - test: a string that contains start_call as a delimiter
# - start_call: a string to split on and find the block after

ARGS = {
    "test": "my_func( () -> inner_block )",
    "start_call": "my_func"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_imports Ran
ran on a synthesized input
microsoft/toga/eval/aggregate_test_cases.py
code served (permissive licence) · get_code("cb2f381214a3dc43")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import os

# Create a temporary Java file with import statements and a @RunWith annotation
temp_dir = tempfile.mkdtemp()
java_file_path = os.path.join(temp_dir, "TestClass.java")

java_content = """import java.util.List;
import java.util.HashMap;
import org.junit.Test;
@RunWith(JUnit4.class)
public class TestClass {
    public void testMethod() {
        // test code
    }
}
"""

with open(java_file_path, 'w') as f:
    f.write(java_content)

ARGS = {
    'java_file': java_file_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_prefix Ran
ran on a synthesized input
microsoft/toga/eval/gen_tests_from_metadata.py
code served (permissive licence) · get_code("322a7d0ecccd0222")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

fail_catch_extract_re = re.compile('try\\s*{(.*;).*fail\\(.*\\)\\s*;\\s*}\\s*catch', re.DOTALL)
assert_re = re.compile('assert\\w*\\s*\\((.*)\\)')

def get_prefix(test):
    open_curly = test.find('{')
    if not 'throws ' in test[:open_curly]:
        test = test[:open_curly] + ' throws Exception ' + test[open_curly:]
    test = test.replace('// Undeclared exception!', '')
    m_try_catch = fail_catch_extract_re.search(test)
    m_assert = assert_re.search(test)
    loc = len(test)
    if m_try_catch:
        loc = m_try_catch.span()[0]
        try_content = ' ' + m_try_catch.group(1).strip()
        return test[0:loc] + try_content
    elif m_assert:
        try:
            assert m_assert
        except AssertionError:
            print('no assertion or try catch in', test)
        loc = m_assert.span()[0]
        return test[0:loc]
    else:
        return test[0:test.rfind('}')]

# Construct test cases for the function
test_with_try_catch = """
public void testMethod() throws Exception {
    try {
        int x = 5; int y = 10;
        fail("Should have thrown exception");
    } catch (Exception e) {
        // expected
    }
}
"""

test_with_assert = """
public void testMethod() {
    int result = calculate();
    assert(result == 42);
    System.out.println("done");
}
"""

test_simple = """
public void testMethod() {
    int x = 5;
    return x;
}
"""

ARGS = {
    'test': test_with_try_catch
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_project_layout Ran
ran on a synthesized input
microsoft/toga/eval/collect_test_results.py
code served (permissive licence) · get_code("b0740759b39327f1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import pandas as pd

# Create a temporary directory structure with a valid dir-layout.csv file
temp_dir = tempfile.mkdtemp()

# Create a sample dir-layout.csv file
csv_content = """project,src_dir,test_dir
example,src/main/java,src/test/java
"""

csv_path = os.path.join(temp_dir, 'dir-layout.csv')
with open(csv_path, 'w') as f:
    f.write(csv_content)

ARGS = {
    'd4j_project_dir': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_test_harness Ran
ran on a synthesized input
microsoft/toga/eval/aggregate_test_cases.py
code served (permissive licence) · get_code("a6787586150c671d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil
from pathlib import Path

# Create temporary directories for testing
test_case_dir = tempfile.mkdtemp()
output_test_dir = tempfile.mkdtemp()

# Create a minimal Java test structure
test_subdir = os.path.join(test_case_dir, "com/example")
os.makedirs(test_subdir, exist_ok=True)

# Create a minimal test.txt file with test case content
test_case_content = """
    @Test
    public void test1() {
        assertEquals(1, 1);
    }
"""
with open(os.path.join(test_case_dir, "test.txt"), "w") as f:
    f.write(test_case_content)

# Create a minimal ESTest.java file
java_file_path = os.path.join(test_subdir, "SampleESTest.java")
java_content = """
import org.junit.runner.RunWith;
import org.evosuite.runtime.EvoRunner;

@RunWith(EvoRunner.class)
public class SampleESTest {
    @Test
    public void test1() {
        assertEquals(1, 1);
    }
}
"""
with open(java_file_path, "w") as f:
    f.write(java_content)

# Define the arguments for get_test_harness
ARGS = {
    "test_case_dir": test_case_dir,
    "output_test_dir": output_test_dir,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_worst_idx Ran
ran on a synthesized input
microsoft/toga/model/ranking.py
code served (permissive licence) · get_code("40f0e80317b58c01")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

MAG = 'threshold_magnitude'
DIFF = 'threshold_diff'

def magnitude(x):
    return x

def diff(x, y):
    return abs(x - y)

def get_worst_idx(scores, method):
    _min = None
    _min_idx = -1
    for idx, (l0, l1) in enumerate(scores):
        if method == MAG:
            m = magnitude(l0)
        elif method == DIFF:
            m = diff(l0, l1)
        if _min == None or m < _min:
            _min = m
            _min_idx = idx
    return _min_idx

# Create test scores: list of tuples (l0, l1) where each is a numeric value
scores = [
    (5.0, 3.0),
    (2.0, 4.0),
    (8.0, 1.0),
]

method = MAG

ARGS = {
    'scores': scores,
    'method': method,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
insert_assertion Ran
ran on a synthesized input
microsoft/toga/eval/gen_tests_from_metadata.py
code served (permissive licence) · get_code("1af26ededf7d7d6e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import sys

torch.manual_seed(0)

# Analyze the function:
# - method: a string that gets strip()'d and split by '\n'
# - assertion: a string that must contain 'assert'
# - The function checks if 'assert' is in assertion
# - It splits method into lines, appends the assertion with indentation, and closes with '}'

# Construct valid arguments
method = """
def some_function():
    x = 1
    y = 2
"""

assertion = "assert x > 0"

ARGS = {
    "method": method,
    "assertion": assertion
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_float Ran
ran on a synthesized input
microsoft/toga/model/assertion_data.py
code served (permissive licence) · get_code("3867c570f55a2b22")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    'string': '3.14'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_int Ran
ran on a synthesized input
microsoft/toga/model/assertion_data.py
code served (permissive licence) · get_code("1ed3568420522363")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

def is_int(string):
    if string[0] == '(' and string[-1] == ')':
        string = string[1:-1]
    if string[-1] == 'L':
        string = string[:-1]
    try:
        int(string)
    except:
        return False
    return True

# The function takes a single parameter: string
# It performs string indexing and manipulation operations
# Valid test cases should be strings

ARGS = {
    "string": "123"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_string Ran
ran on a synthesized input
microsoft/toga/model/assertion_data.py
code served (permissive licence) · get_code("3f624daa44a57816")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "string": '"hello world"'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
magnitude Ran
ran on a synthesized input
microsoft/toga/model/ranking.py
code served (permissive licence) · get_code("b1e068a15b29a878")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "x": torch.randn(2, 4)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
checkout_project Not yet run
unverified (harvested, no recorded run)
microsoft/toga/eval/extract_tests.py
code served (permissive licence) · get_code("302fca0ae159d4a6")
How it ran

no invocation recorded.

get_bug_catching_tests Not yet run
unverified (harvested, no recorded run)
microsoft/toga/eval/extract_bug_metadata.py
code served (permissive licence) · get_code("a260552ed8c878b5")
How it ran

no invocation recorded.

normalize_assertThrows Not yet run
unverified (harvested, no recorded run)
microsoft/toga/model/exception_data.py
code served (permissive licence) · get_code("c1793bf24d6a0bf4")
How it ran

no invocation recorded.

simple_accuracy Not yet run
unverified (harvested, no recorded run)
microsoft/toga/model/assertions/utils.py
code served (permissive licence) · get_code("3c241ecfe3749a6d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 22 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 2 the same month, 3 later) and 19 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
simple_accuracy 59 other papers
35 dated earlier, 3 the same month, 21 later
1506.05865 (2015-06)
LCSTS: A Large Scale Chinese Short Text Summarization Dataset
1509.01626 (2015-09)
Character-level Convolutional Networks for Text Classification *
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
and 56 more not named here
acc_and_f1 22 other papers
10 dated earlier, 1 the same month, 11 later
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1905.12866 (2019-05)
Semantically Conditioned Dialog Response Generation via Hierarchical Disentangled Self-Attention
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
and 19 more not named here
accuracy 21 other papers
19 dated earlier, 2 later
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.08746 (2019-01)
BioBERT: a pre-trained biomedical language representation model for biomedical text mining
1904.03323 (2019-04)
Publicly Available Clinical BERT Embeddings
and 18 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Testing is widely recognized as an important stage of the software development lifecycle. Effective software testing can provide benefits such as bug finding, preventing regressions, and documentation. In terms of documentation, unit tests express a unit's intended functionality, as conceived by the developer. A test oracle, typically expressed as an condition, documents the intended behavior of a unit under a given test prefix. Synthesizing a functional test oracle is a challenging problem, as it must capture the intended functionality rather than the implemented functionality. In this paper, we propose TOGA (a neural method for Test Oracle GenerAtion), a unified transformer-based neural approach to infer both exceptional and assertion test oracles based on the context of the focal method. Our approach can handle units with ambiguous or missing documentation, and even units with a missing implementation. We evaluate our approach on both oracle inference accuracy and functional bug-finding. Our technique improves accuracy by 33\% over existing oracle inference approaches, achieving 96\% overall accuracy on a held out test dataset. Furthermore, we show that when integrated with a automated test generation tool (EvoSuite), our approach finds 57 real world bugs in large-scale Java programs, including 30 bugs that are not found by any other automated testing method in our evaluation.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2109.09262")
get_code_for_paper("2109.09262")
have("2109.09262")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2109.09262.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2109.09262.svg)](https://syntology.ai/paper/2109.09262)

Connect an agent — have() is free.