Exemple #1
0
 def test_caret_will_not_drop_past_item_depth(self) -> None:
     """Raise error before dropping caret past item_depth"""
     inst = DepthCollector(3)  # at depth 1
     inst.drop_caret()  # at depth 2
     inst.drop_caret()  # at depth 3 (item_depth)
     with pytest.raises(CaretDepthError):
         inst.drop_caret()
Exemple #2
0
 def test_raise_caret(self) -> None:
     """Reduce caret list by one."""
     inst = DepthCollector(3)  # caret = [[]]
     inst.drop_caret()
     assert inst.rightmost_branches == [[[]], []]
     inst.raise_caret()
     assert inst.rightmost_branches == [[[]]]
Exemple #3
0
 def test_last_caret(self) -> None:
     """Add empty list to caret[-1]. Append pointer to new list to caret. """
     inst = DepthCollector(3)
     inst.drop_caret()
     assert inst.rightmost_branches == [[[]], []]
     assert inst.rightmost_branches[-1] is inst.rightmost_branches[-2][-1]