Fixed a test suite syntax error in command testing.

This commit is contained in:
Griatch 2011-02-28 00:34:03 +00:00
parent 0612e9ff31
commit e094a4d173
2 changed files with 18 additions and 7 deletions

View file

@ -143,8 +143,12 @@ class TestPassword(CommandTest):
self.execute_cmd("@password testpassword = newpassword") self.execute_cmd("@password testpassword = newpassword")
class TestNick(CommandTest): class TestNick(CommandTest):
def test_call(self): def test_call(self):
self.execute_cmd("nickname testalias = testaliasedstring") self.execute_cmd("nickname testalias = testaliasedstring1")
self.assertEquals("testaliasedstring", self.char1.nicks.get("testalias", None)) self.execute_cmd("nickname/player testalias = testaliasedstring2")
self.execute_cmd("nickname/object testalias = testaliasedstring3")
self.assertEquals(u"testaliasedstring1", self.char1.nickhandler("testalias"))
self.assertEquals(u"testaliasedstring2", self.char1.nickhandler("testalias",nick_type="player"))
self.assertEquals(u"testaliasedstring3", self.char1.nickhandler("testalias",nick_type="object"))
# system.py command tests # system.py command tests
class TestPy(CommandTest): class TestPy(CommandTest):

View file

@ -269,11 +269,11 @@ class Attribute(SharedMemoryModel):
def _convert_value(self, in_value): def _convert_value(self, in_value):
""" """
We have to be careful as to what we store. Some things, We have to be careful as to what we store. Some things, such
such as dhango model instances, cannot be directly stored/pickled as django model instances, cannot be directly stored/pickled
in an attribute, so we have to be clever about it. in an attribute, so we have to be clever about it. Types of
Types of objects and how they are handled: objects and how they are handled:
* str - s5Atored directly in field * str - stored directly in field
* django model object - store its dbref in field * django model object - store its dbref in field
* any other python structure - pickle in field * any other python structure - pickle in field
@ -294,6 +294,13 @@ class Attribute(SharedMemoryModel):
# strings we just store directly. # strings we just store directly.
return in_value, None return in_value, None
if is_iter(in_value):
# an iterable. This is normally something to pickle,
# but we have to be careful so as to not find
# django model instances nested in the iterable.
pass #TODO!
if not has_parent('django.db.models.base.Model', in_value) \ if not has_parent('django.db.models.base.Model', in_value) \
and not has_parent(PARENTS['typeclass'], in_value): and not has_parent(PARENTS['typeclass'], in_value):
# non-django models that are not strings we pickle # non-django models that are not strings we pickle