def test_checkCollisions_emptyCollisionsListWhenOtherEntityXPosEqualsSpriteSize(self): entityToTest, otherEntity = Entity(), Entity() otherEntity.x += SPRITE_SIZE entities.append(otherEntity) entityToTest.check_collisions() self.assertFalse(collisions)
def test_checkCollisions_entityDoesNotCollideWithSelf(self): entityToTest = Entity() entities.append(entityToTest) entityToTest.check_collisions() self.assertFalse(collisions)
def test_checkCollisions_oneCollisionDetectedWhenOtherEntityXPosLessThanSpriteSize(self): entityToTest, otherEntity = Entity(), Entity() otherEntity.x += SPRITE_SIZE-1 entities.append(otherEntity) entityToTest.check_collisions() self.assertListEqual(collisions, [(entityToTest, otherEntity)])
def test_checkCollisions_collisionsListContainsCollidedEntities(self): entityToTest = Entity() entityCollidedWith = Entity() entities.append(entityCollidedWith) entityToTest.check_collisions() self.assertListEqual(collisions, [(entityToTest, entityCollidedWith)])