diff options
author | Brian Waldon <bcwaldon@gmail.com> | 2012-07-27 11:28:01 -0700 |
---|---|---|
committer | Brian Waldon <bcwaldon@gmail.com> | 2012-07-27 11:29:52 -0700 |
commit | 2c24556370b82dac6f97d316ec75931a74987b86 (patch) | |
tree | c1ae90e896e476e561102a52ad66901fd26b835a /test | |
parent | d93ca7833f4907939507bc99648de4d4d6eb0616 (diff) | |
download | warlock-2c24556370b82dac6f97d316ec75931a74987b86.tar.gz |
Enable dict-style access to models
Allow get and set of model attributes using dict-like
syntax (i.e. model['attribute'] = 'value').
Bump version to 0.2.0
Diffstat (limited to 'test')
-rw-r--r-- | test/test_core.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/test_core.py b/test/test_core.py index c7f0636..761da16 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -58,6 +58,12 @@ class TestCore(unittest.TestCase): def test_iteritems(self): Country = warlock.model_factory(fixture) sweden = Country(name='Sweden', population=9379116) - print sweden.iteritems() self.assertEqual(set(list(sweden.iteritems())), set([('name', 'Sweden'), ('population', 9379116)])) + + def test_dict_syntax(self): + Country = warlock.model_factory(fixture) + sweden = Country(name='Sweden', population=9379116) + self.assertEqual(sweden['name'], 'Sweden') + sweden['name'] = 'Finland' + self.assertEqual(sweden['name'], 'Finland') |