コード例 #1
0
ファイル: test_aspects.py プロジェクト: thetestgame/wecs
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)
コード例 #2
0
ファイル: test_aspects.py プロジェクト: thetestgame/wecs
def test_aspect_not_in_entity(world):
    entity = world.create_entity()
    aspect = Aspect([Component_A])
    assert not aspect.in_entity(entity)
コード例 #3
0
ファイル: test_aspects.py プロジェクト: thetestgame/wecs
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)