evennia.contrib.rpg.traits.tests¶
Unit test module for Trait classes.
- class evennia.contrib.rpg.traits.tests.TraitHandlerTest(methodName='runTest')[source]¶
Bases:
_TraitHandlerBaseTesting for TraitHandler
- test_trait_db_connection()[source]¶
Test that updating a trait property actually updates value in db
Test traits related to each other via Trait.get_trait()
- class evennia.contrib.rpg.traits.tests.TestTrait(methodName='runTest')[source]¶
Bases:
_TraitHandlerBaseTest the base Trait class
- class evennia.contrib.rpg.traits.tests.TestTraitStatic(methodName='runTest')[source]¶
Bases:
_TraitHandlerBaseTest for static Traits
- class evennia.contrib.rpg.traits.tests.TestTraitCounter(methodName='runTest')[source]¶
Bases:
_TraitHandlerBaseTest for counter- Traits
- class evennia.contrib.rpg.traits.tests.TestTraitCounterTimed(methodName='runTest')[source]¶
Bases:
_TraitHandlerBaseTest for trait with timer component
- class evennia.contrib.rpg.traits.tests.TestTraitGauge(methodName='runTest')[source]¶
Bases:
_TraitHandlerBase
- class evennia.contrib.rpg.traits.tests.TestTraitGaugeTimed(methodName='runTest')[source]¶
Bases:
_TraitHandlerBaseTest for trait with timer component
- class evennia.contrib.rpg.traits.tests.TestNumericTraitOperators(methodName='runTest')[source]¶
Bases:
BaseEvenniaTestCaseTest case for numeric magic method implementations.
- class evennia.contrib.rpg.traits.tests.DummyCharacter[source]¶
Bases:
_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:
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:
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:
DoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- path = 'evennia.contrib.rpg.traits.tests.TraitContribTestingChar'¶
- typename = 'TraitContribTestingChar'¶
- class evennia.contrib.rpg.traits.tests.TraitPropertyTestCase(methodName='runTest')[source]¶
Bases:
EvenniaTestTest atomic updating.
- character_typeclass¶
alias of
TraitContribTestingChar