Exemplo n.º 1
0
def test_remove_aspect_from_entity(world):
    aspect = Aspect([Component_A])
    entity = world.create_entity(*aspect())
    world._flush_component_updates()
    assert aspect.in_entity(entity)
    components = aspect.remove(entity)
    world._flush_component_updates()
    assert not aspect.in_entity(entity)
    assert Component_A not in entity
    assert len(components) == 1
    assert isinstance(components[0], Component_A)
Exemplo n.º 2
0
def test_aspect_not_in_entity(world):
    entity = world.create_entity()
    aspect = Aspect([Component_A])
    assert not aspect.in_entity(entity)
Exemplo n.º 3
0
def test_aspect_in_entity(world):
    aspect = Aspect([Component_A])
    entity = world.create_entity()
    aspect.add(entity)
    world._flush_component_updates()
    assert aspect.in_entity(entity)