Пример #1
0
 def test_set_nth(self, str_stack: PushStack):
     str_stack.push("a").push("b").push("c").push("d").set_nth(1, "z")
     assert len(str_stack) == 4
     assert str_stack.nth(1) == "z"
Пример #2
0
 def test_nth_oob(self, int_stack: PushStack):
     int_stack.push(5)
     assert int_stack.nth(1) == Token.no_stack_item
Пример #3
0
 def test_insert_oob(self, str_stack: PushStack):
     str_stack.push("a").push("b").push("c").insert(10, "z")
     assert len(str_stack) == 4
     assert str_stack.nth(1) == "b"
     assert str_stack.nth(3) == "z"
Пример #4
0
 def test_nth(self, int_stack: PushStack):
     int_stack.push(5).push(4).push(3)
     assert int_stack.nth(1) == 4
Пример #5
0
 def test_set_nth(self, str_stack: PushStack):
     str_stack.push("a").push("b").push("c").push("d").set_nth(1, "z")
     assert len(str_stack) == 4
     assert str_stack.nth(1) == "z"
Пример #6
0
 def test_insert_oob(self, str_stack: PushStack):
     str_stack.push("a").push("b").push("c").insert(10, "z")
     assert len(str_stack) == 4
     assert str_stack.nth(1) == "b"
     assert str_stack.nth(3) == "z"
Пример #7
0
 def test_nth_oob(self, int_stack: PushStack):
     int_stack.push(5)
     assert int_stack.nth(1) == Token.no_stack_item
Пример #8
0
 def test_nth(self, int_stack: PushStack):
     int_stack.push(5).push(4).push(3)
     assert int_stack.nth(1) == 4