-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTurtlePartTest.py
More file actions
46 lines (32 loc) · 1017 Bytes
/
Copy pathTurtlePartTest.py
File metadata and controls
46 lines (32 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from TurtlePart import *
import unittest
class TurtlePartTest(unittest.TestCase):
def test_head(self):
t = TurtlePart("T")
self.assertEqual(str(t), "T")
def test_body(self):
t = TurtlePart("C")
self.assertEqual(str(t), "C")
def test_wrong(self):
self.assertRaises(TurtlePartException, TurtlePart, "A")
def test_equality(self):
c1 = TurtlePart("C")
c2 = TurtlePart("C")
self.assertNotEqual(c1, c2)
self.assertTrue(c1.equals(c2))
def test_matches(self):
c1 = TurtlePart("C")
c2 = TurtlePart("C")
c3 = TurtlePart("T")
self.assertTrue(c1.matches(c3))
self.assertFalse(c1.matches(c2))
def test_copy(self):
c1 = TurtlePart("C")
c2 = c1.copy()
self.assertTrue(c1.equals(c2))
def test_inequality(self):
c = TurtlePart("C")
t = TurtlePart("T")
self.assertTrue(not c.equals(t))
if __name__ == "__main__":
unittest.main()