evennia.contrib.rpg.traits.tests¶
Unit test module for Trait classes.
-
class
evennia.contrib.rpg.traits.tests.TraitHandlerTest(methodName='runTest')[source]¶ Bases:
evennia.contrib.rpg.traits.tests._TraitHandlerBaseTesting for TraitHandler
-
class
evennia.contrib.rpg.traits.tests.TestTrait(methodName='runTest')[source]¶ Bases:
evennia.contrib.rpg.traits.tests._TraitHandlerBaseTest the base Trait class
-
class
evennia.contrib.rpg.traits.tests.TestTraitStatic(methodName='runTest')[source]¶ Bases:
evennia.contrib.rpg.traits.tests._TraitHandlerBaseTest for static Traits
-
class
evennia.contrib.rpg.traits.tests.TestTraitCounter(methodName='runTest')[source]¶ Bases:
evennia.contrib.rpg.traits.tests._TraitHandlerBaseTest for counter- Traits
-
class
evennia.contrib.rpg.traits.tests.TestTraitCounterTimed(methodName='runTest')[source]¶ Bases:
evennia.contrib.rpg.traits.tests._TraitHandlerBaseTest for trait with timer component
-
class
evennia.contrib.rpg.traits.tests.TestTraitGauge(methodName='runTest')[source]¶ Bases:
evennia.contrib.rpg.traits.tests._TraitHandlerBase
-
class
evennia.contrib.rpg.traits.tests.TestTraitGaugeTimed(methodName='runTest')[source]¶ Bases:
evennia.contrib.rpg.traits.tests._TraitHandlerBaseTest for trait with timer component
-
class
evennia.contrib.rpg.traits.tests.TestNumericTraitOperators(methodName='runTest')[source]¶ Bases:
evennia.utils.test_resources.BaseEvenniaTestCaseTest case for numeric magic method implementations.
-
class
evennia.contrib.rpg.traits.tests.DummyCharacter[source]¶ Bases:
evennia.contrib.rpg.traits.tests._MockObj-
strength¶ Allows for applying traits as individual properties directly on the parent class instead for properties on the .traits handler. So with this you could access data e.g. as character.hp.value instead of character.traits.hp.value. This still uses the traitshandler under the hood.
Example:
from evennia.utils import lazy_property from evennia.contrib.rpg.traits import TraitProperty class Character(DefaultCharacter): strength = TraitProperty(name="STR", trait_type="static", base=10, mod=2) hunting = TraitProperty("Hunting Skill", trait_type="counter", base=10, mod=1, max=100) health = TraitProperty(trait_type="gauge", min=0, base=100)
- Type
Optional extra
-
hunting¶ Allows for applying traits as individual properties directly on the parent class instead for properties on the .traits handler. So with this you could access data e.g. as character.hp.value instead of character.traits.hp.value. This still uses the traitshandler under the hood.
Example:
from evennia.utils import lazy_property from evennia.contrib.rpg.traits import TraitProperty class Character(DefaultCharacter): strength = TraitProperty(name="STR", trait_type="static", base=10, mod=2) hunting = TraitProperty("Hunting Skill", trait_type="counter", base=10, mod=1, max=100) health = TraitProperty(trait_type="gauge", min=0, base=100)
- Type
Optional extra
-
health¶ Allows for applying traits as individual properties directly on the parent class instead for properties on the .traits handler. So with this you could access data e.g. as character.hp.value instead of character.traits.hp.value. This still uses the traitshandler under the hood.
Example:
from evennia.utils import lazy_property from evennia.contrib.rpg.traits import TraitProperty class Character(DefaultCharacter): strength = TraitProperty(name="STR", trait_type="static", base=10, mod=2) hunting = TraitProperty("Hunting Skill", trait_type="counter", base=10, mod=1, max=100) health = TraitProperty(trait_type="gauge", min=0, base=100)
- Type
Optional extra
-
-
class
evennia.contrib.rpg.traits.tests.TestTraitFields(methodName='runTest')[source]¶ Bases:
evennia.utils.test_resources.BaseEvenniaTestCaseTest the TraitField class.
-
class
evennia.contrib.rpg.traits.tests.TraitContribTestingChar(id, db_key, db_typeclass_path, db_date_created, db_lock_storage, db_account, db_sessid, db_location, db_home, db_destination, db_cmdset_storage)[source]¶ Bases:
evennia.objects.objects.DefaultCharacter-
HP¶ Allows for applying traits as individual properties directly on the parent class instead for properties on the .traits handler. So with this you could access data e.g. as character.hp.value instead of character.traits.hp.value. This still uses the traitshandler under the hood.
Example:
from evennia.utils import lazy_property from evennia.contrib.rpg.traits import TraitProperty class Character(DefaultCharacter): strength = TraitProperty(name="STR", trait_type="static", base=10, mod=2) hunting = TraitProperty("Hunting Skill", trait_type="counter", base=10, mod=1, max=100) health = TraitProperty(trait_type="gauge", min=0, base=100)
- Type
Optional extra
-
exception
DoesNotExist¶ Bases:
evennia.objects.objects.DefaultCharacter.DoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
evennia.objects.objects.DefaultCharacter.MultipleObjectsReturned
-
path= 'evennia.contrib.rpg.traits.tests.TraitContribTestingChar'¶
-
typename= 'TraitContribTestingChar'¶
-
-
class
evennia.contrib.rpg.traits.tests.TraitPropertyTestCase(methodName='runTest')[source]¶ Bases:
evennia.utils.test_resources.EvenniaTestTest atomic updating.
-
character_typeclass¶ alias of
TraitContribTestingChar
-