Exemplo n.º 1
0
 def test_top(self, int_stack: PushStack):
     int_stack.push(5).push(-10)
     assert int_stack.top() == -10
Exemplo n.º 2
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"
Exemplo n.º 3
0
 def test_nth(self, int_stack: PushStack):
     int_stack.push(5).push(4).push(3)
     assert int_stack.nth(1) == 4
Exemplo n.º 4
0
 def test_nth_oob(self, int_stack: PushStack):
     int_stack.push(5)
     assert int_stack.nth(1) == Token.no_stack_item
Exemplo n.º 5
0
 def test_push_wrong_type(self, int_stack: PushStack):
     with pytest.raises(PushError):
         int_stack.push("zz")
Exemplo n.º 6
0
 def test_push_wrong_type(self, int_stack: PushStack):
     with pytest.raises(PushError):
         int_stack.push("zz")
Exemplo n.º 7
0
 def test_set_nth_oob(self, str_stack: PushStack):
     with pytest.raises(IndexError):
         str_stack.push("a").push("b").push("c").set_nth(10, "z")
Exemplo n.º 8
0
 def test_flush(self, int_stack: PushStack):
     int_stack.push(1).push(-1).flush()
     assert len(int_stack) == 0
Exemplo n.º 9
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"
Exemplo n.º 10
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"
Exemplo n.º 11
0
 def test_top(self, int_stack: PushStack):
     int_stack.push(5).push(-10)
     assert int_stack.top() == -10
Exemplo n.º 12
0
 def test_nth_oob(self, int_stack: PushStack):
     int_stack.push(5)
     assert int_stack.nth(1) == Token.no_stack_item
Exemplo n.º 13
0
 def test_nth(self, int_stack: PushStack):
     int_stack.push(5).push(4).push(3)
     assert int_stack.nth(1) == 4
Exemplo n.º 14
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"
Exemplo n.º 15
0
 def test_flush(self, int_stack: PushStack):
     int_stack.push(1).push(-1).flush()
     assert len(int_stack) == 0
Exemplo n.º 16
0
 def test_set_nth_oob(self, str_stack: PushStack):
     with pytest.raises(IndexError):
         str_stack.push("a").push("b").push("c").set_nth(10, "z")
Exemplo n.º 17
0
 def test_push(self, int_stack: PushStack):
     int_stack.push(5)
     assert len(int_stack) == 1
Exemplo n.º 18
0
 def test_large_str(self, str_stack: PushStack):
     s = "largestr" * 1000
     str_stack.push(s)
     assert len(str_stack.pop()) != len(s)
Exemplo n.º 19
0
 def test_push(self, int_stack: PushStack):
     int_stack.push(5)
     assert len(int_stack) == 1