def test_add_entity__full__returns_False(): em = EntityManager(capacity=1) e = Entity(name="fleeb", item="item") f = Entity(name="floop", item="item") em.add_entity(e) assert em.is_full() assert em.add_entity(f) is False
def test_add_entity__e_has_required_component(): em = EntityManager(required_comp="item") e = Entity(name="fleeb", item="item") assert em.add_entity(e)
def test_add_entity__e_missing_required_component__raise_ValueError(): em = EntityManager(required_comp="item") with pytest.raises(ValueError): em.add_entity(Entity(name="fleeb"))
def test_init__add_entity_when_full_returns_False(): em = EntityManager(capacity=1) em.add_entity(Entity(name="fleeb")) assert em.add_entity(Entity(name="floop")) is False
def em(): return EntityManager()
def test_init__default_capacity_is_NO_LIMIT(): em = EntityManager() assert em.capacity == NO_LIMIT
def test_init__capacity(): em = EntityManager(capacity=1) assert em.capacity == 1
def test_is_full__no_capacity__never_is_full(): em = EntityManager() assert not em.is_full() em.add_entity(Entity(name="fleeb")) assert not em.is_full()
def test_is_full__set_capacity_has_space(): em = EntityManager(capacity=1) assert not em.is_full()
def test_is_full__set_capacity_is_full(): em = EntityManager(capacity=1) em.add_entity(Entity(name="fleeb")) assert em.is_full()
def test_init__required_components(): em = EntityManager(required_comp="item") assert em.required_comp == "item"
def test_add_item__has_required_component(fleeb3): em = EntityManager(required_comp="item") assert em.add_item(fleeb3)
def test_add_entity__dupe_in_em__returns_False(): em = EntityManager() e = Entity(name="fleeb", item="item") em.add_entity(e) assert em.add_entity(e) is False
def test_add_entity__added__returns_True(): em = EntityManager() e = Entity(name="fleeb", item="item") assert em.add_entity(e)