Example #1
0
def test_add_entry():
    trace = ot.OutputTrace()
    variable = MagicMock()
    variable.get_statement_position.return_value = 42
    entry = MagicMock()
    trace.add_entry(1337, variable, entry)
    assert trace._trace == {1337: {42: entry}}
Example #2
0
def test_clone():
    trace = ot.OutputTrace()
    variable = MagicMock()
    variable.get_statement_position.return_value = 42
    entry = MagicMock()
    cloned_entry = MagicMock()
    entry.clone.return_value = cloned_entry
    trace.add_entry(1337, variable, entry)
    clone = trace.clone()
    assert clone._trace == {1337: {42: cloned_entry}}
Example #3
0
def test_get_assertions():
    trace = ot.OutputTrace()
    variable = MagicMock()
    variable.get_statement_position.return_value = 42
    entry = MagicMock()
    assertion = MagicMock()
    entry.get_assertions.return_value = {assertion}
    trace.add_entry(3, variable, entry)
    statement = MagicMock()
    statement.get_position.return_value = 3
    assert trace.get_assertions(statement) == {assertion}
 def __init__(self) -> None:
     self._trace: ot.OutputTrace[T] = ot.OutputTrace()
Example #5
0
def test_get_assertions_empty():
    statement = MagicMock()
    statement.get_position.return_value = 3
    trace = ot.OutputTrace()
    assert trace.get_assertions(statement) == set()
Example #6
0
def test_empty():
    trace = ot.OutputTrace()
    assert trace._trace == {}