Skip to content

Commit

Permalink
change tests to expect containers to normalize their values eagerly
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyroberts committed Aug 23, 2013
1 parent 27d2949 commit 3b2d165
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1560,15 +1560,15 @@ class A(Document):
a.d = {}

a.d['test'] = { 'a': datetime(2009, 5, 10, 21, 19, 21, 127380) }
self.assertEqual(a.d, {'test': {'a': datetime(2009, 5, 10, 21, 19, 21, 127380)}})
self.assertEqual(a.d, {'test': {'a': datetime(2009, 5, 10, 21, 19, 21)}})
self.assertEqual(a._doc, {'d': {'test': {'a': '2009-05-10T21:19:21Z'}}, 'doc_type': 'A'} )

a.d['test']['b'] = "essai"
self.assertEqual(a._doc, {'d': {'test': {'a': '2009-05-10T21:19:21Z', 'b': 'essai'}}, 'doc_type': 'A'})

a.d['essai'] = "test"
self.assert_(a.d == {'essai': 'test',
'test': {'a': datetime(2009, 5, 10, 21, 19, 21, 127380),
'test': {'a': datetime(2009, 5, 10, 21, 19, 21),
'b': 'essai'}}
)
self.assert_(a._doc == {'d': {'essai': 'test', 'test': {'a': '2009-05-10T21:19:21Z', 'b': 'essai'}},
Expand All @@ -1581,7 +1581,7 @@ class A(Document):
a.d['test']['essai'] = { "a": datetime(2009, 5, 10, 21, 21, 11, 425782) }
self.assert_(a.d == {'essai': 'test',
'test': {'b': 'essai',
'essai': {'a': datetime(2009, 5, 10, 21, 21, 11, 425782)}}}
'essai': {'a': datetime(2009, 5, 10, 21, 21, 11)}}}
)
self.assert_(a._doc == {'d': {'essai': 'test',
'test': {'b': 'essai', 'essai': {'a': '2009-05-10T21:21:11Z'}}},
Expand Down Expand Up @@ -1636,7 +1636,7 @@ class A(Document):
a.l.append(1)
a.l.append(datetime(2009, 5, 12, 13, 35, 9, 425701))
a.l.append({ 's': "test"})
self.assertEqual(a.l, [1, datetime(2009, 5, 12, 13, 35, 9, 425701), {'s': 'test'}])
self.assertEqual(a.l, [1, datetime(2009, 5, 12, 13, 35, 9), {'s': 'test'}])
self.assert_(a._doc == {'doc_type': 'A', 'l': [1, '2009-05-12T13:35:09Z', {'s': 'test'}]}
)
a.l[2]['date'] = datetime(2009, 5, 12, 13, 35, 9, 425701)
Expand All @@ -1655,8 +1655,8 @@ class A(Document):

a.l[2]['s'] = 'test edited'
self.assert_(a.l == [1,
datetime(2009, 5, 12, 13, 35, 9, 425701),
{'date': datetime(2009, 5, 12, 13, 35, 9, 425701),
datetime(2009, 5, 12, 13, 35, 9),
{'date': datetime(2009, 5, 12, 13, 35, 9),
's': 'test edited'}]
)
self.assert_(a._doc['l'] == [1,
Expand Down

0 comments on commit 3b2d165

Please sign in to comment.