Beispiel #1
0
 def test_locate(self):
     m = Map()
     thing = object()
     other = object()
     m.place(thing, "fresno")
     assert m.locate(thing) == "fresno"
     assert m.locate(other) is None
Beispiel #2
0
 def test_locate(self):
     m = Map()
     thing = object()
     other = object()
     m.place(thing, "fresno")
     assert m.locate(thing) == "fresno"
     assert m.locate(other) is None
Beispiel #3
0
 def test_remove(self):
     m = Map()
     o1 = object()
     m.place(o1, (3, 3))
     assert m.isOccupied((3, 3))
     m.remove(o1)
     assert not m.isOccupied((3, 3))
Beispiel #4
0
 def test_remove(self):
     m = Map()
     o1 = object()
     m.place(o1, (3,3))
     assert m.isOccupied((3,3))
     m.remove(o1)
     assert not m.isOccupied((3,3))
Beispiel #5
0
 def test_findAdjacent(self):
     m = Map()
     assert m.findAdjacent(m.NORTH, (5,5)) == (5,4)
     assert m.findAdjacent(m.SOUTH, (5,5)) == (5,6)
     assert m.findAdjacent(m.EAST, (5,5)) == (6,5)
     assert m.findAdjacent(m.WEST, (5,5)) == (4,5)
Beispiel #6
0
 def test_move(self):
     m = Map()
     m.place(object, (0,0))
     m.move(object, (5,5))
     assert m.isOccupied((5,5))
     assert not m.isOccupied((0,0))
Beispiel #7
0
 def test_place(self):
     m = Map()
     m.place(object(), (3,3))
     assert m.isOccupied((3,3))
     assert not m.isOccupied((3,4))
Beispiel #8
0
 def __init__(self, map=None):
     super(Game, self).__init__()
     self.map = map or Map()
Beispiel #9
0
 def test_findAdjacent(self):
     m = Map()
     assert m.findAdjacent(m.NORTH, (5, 5)) == (5, 4)
     assert m.findAdjacent(m.SOUTH, (5, 5)) == (5, 6)
     assert m.findAdjacent(m.EAST, (5, 5)) == (6, 5)
     assert m.findAdjacent(m.WEST, (5, 5)) == (4, 5)
Beispiel #10
0
 def test_move(self):
     m = Map()
     m.place(object, (0, 0))
     m.move(object, (5, 5))
     assert m.isOccupied((5, 5))
     assert not m.isOccupied((0, 0))
Beispiel #11
0
 def test_place(self):
     m = Map()
     m.place(object(), (3, 3))
     assert m.isOccupied((3, 3))
     assert not m.isOccupied((3, 4))