def test_close_station(self): a = Station(1) b = Station(2) a.add_connection(b) self.assertEqual(len(b), 1) a.close() self.assertEqual(len(b), 0)
def test_cat_move(self): s1 = Station(1) s2 = Station(2) c = Cat(1, s1) s1.add_connection(s2) self.assertEqual(c.state, s1) c.action() self.assertEqual(c.state, s2) c.action() self.assertEqual(c.state, s1)
def test_human_move(self): s1 = Station(1) s2 = Station(2) h = Human(1, s1) s1.add_connection(s2) self.assertEqual(h.state, s1) self.assertEqual(h.memory, [s1]) h.action() self.assertEqual(h.state, s2) self.assertEqual(h.memory, [s1, s2])
def test_len(self): a = Station(1) a.add_connection(Station(2)) self.assertEqual(len(a), 1)