class ObjectsTests(unittest.TestCase): def setUp(self): super(ObjectsTests, self).setUp() self.game = game() self.game.initialize() self.objects = Objects() def test_at_found(self): # Setup self.objects.append(Object(self.game, name='yes', x=0, y=0)) self.objects.append(Object(self.game, name='no', x=1, y=0)) self.objects.append(Object(self.game, name='no', x=0, y=1)) # Test found = self.objects.at(0, 0) # Verify self.assertTrue(found is not None) self.assertEqual('yes', found.name) def test_at_not_found(self): # Setup self.objects.append(Object(self.game, name='yes', x=0, y=0)) self.objects.append(Object(self.game, name='no', x=1, y=0)) self.objects.append(Object(self.game, name='no', x=0, y=1)) # Test found = self.objects.at(10, 10) # Verify self.assertTrue(found is None) def test_at_multiple(self): # Setup self.objects.append(Object(self.game, name='first', x=0, y=0)) self.objects.append(Object(self.game, name='second', x=0, y=0)) self.objects.append(Object(self.game, name='no', x=0, y=1)) # Test found = self.objects.at(0, 0) # Verify self.assertTrue(found is not None) self.assertEqual('first', found.name)