mirror of
https://github.com/evennia/evennia.git
synced 2026-03-28 02:36:32 +01:00
Added test case
This commit is contained in:
parent
2a34e9d05d
commit
889f136031
1 changed files with 12 additions and 0 deletions
|
|
@ -42,6 +42,10 @@ class CharacterWithComponents(ComponentHolderMixin, DefaultCharacter):
|
|||
test_b = ComponentProperty("test_b", my_int=3, my_list=[1, 2, 3])
|
||||
|
||||
|
||||
class InheritedTCWithComponents(CharacterWithComponents):
|
||||
test_c = ComponentProperty("test_c")
|
||||
|
||||
|
||||
class TestComponents(EvenniaTest):
|
||||
character_typeclass = CharacterWithComponents
|
||||
|
||||
|
|
@ -49,6 +53,14 @@ class TestComponents(EvenniaTest):
|
|||
assert self.char1.test_a
|
||||
assert self.char1.test_b
|
||||
|
||||
def test_inherited_typeclass_does_not_include_child_class_components(self):
|
||||
char_with_c = create.create_object(
|
||||
InheritedTCWithComponents, key="char_with_c", location=self.room1, home=self.room1
|
||||
)
|
||||
assert self.char1.test_a
|
||||
assert not self.char1.cmp.get('test_c')
|
||||
assert char_with_c.test_c
|
||||
|
||||
def test_character_instances_components_properly(self):
|
||||
assert isinstance(self.char1.test_a, ComponentTestA)
|
||||
assert isinstance(self.char1.test_b, ComponentTestB)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue