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)
def test_remove_aspect_from_entity_that_does_not_have_it(world): aspect = Aspect([Component_A]) entity = world.create_entity() with pytest.raises(ValueError): aspect.remove(entity)