Made instruction representation tests more independant
This commit is contained in:
parent
ddc6b775ae
commit
f1c02012a2
1 changed files with 17 additions and 4 deletions
|
@ -30,13 +30,26 @@ def instr():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def test_default_repr_instruction_only(instr: _Instruction):
|
||||||
|
"""Default representation returns action followed by ``()``."""
|
||||||
|
rv = instr.repr_instruction_only()
|
||||||
|
assert rv == _INSTR_REPR
|
||||||
|
|
||||||
|
|
||||||
class TestRepr:
|
class TestRepr:
|
||||||
"""Tests for the ``__repr__`` method."""
|
"""Tests for the ``__repr__`` method."""
|
||||||
|
|
||||||
def test_default_repr_instruction_only(self, instr: _Instruction):
|
@pytest.fixture
|
||||||
"""Default representation returns action followed by ``()``."""
|
def instr(self):
|
||||||
rv = instr.repr_instruction_only()
|
"""Create a mock instruction suitable for testing."""
|
||||||
assert rv == _INSTR_REPR
|
instr = _Instruction(
|
||||||
|
mock.MagicMock(), mock.MagicMock(), mock.MagicMock(), _ACTION_NAME
|
||||||
|
)
|
||||||
|
instr.repr_instruction_only = mock.MagicMock(return_value=_INSTR_REPR)
|
||||||
|
return instr
|
||||||
|
|
||||||
def test_repr_no_flow(self, instr: _Instruction):
|
def test_repr_no_flow(self, instr: _Instruction):
|
||||||
"""``repr()`` returns default representation if there is no flow \
|
"""``repr()`` returns default representation if there is no flow \
|
||||||
|
|
Loading…
Reference in a new issue