Skip to content

Commit

Permalink
change tests to expect adding the wrong type of element to a typed co…
Browse files Browse the repository at this point in the history
…ntainer to fail fast

raises BadValueError
  • Loading branch information
dannyroberts committed Aug 23, 2013
1 parent d6d27b0 commit 27d2949
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,17 +1338,17 @@ def testListPropertyWithType(self):
from datetime import datetime
class A(Document):
l = ListProperty(item_type=datetime)
a = A()
a.l.append("test")
self.assertRaises(BadValueError, a.validate)
a = A()
with self.assertRaises(BadValueError):
a.l.append("test")

class B(Document):
ls = StringListProperty()
b = B()
b.ls.append(u"test")
b.ls.append(datetime.utcnow())
self.assertRaises(BadValueError, b.validate)
self.assertIsNone(b.validate())
with self.assertRaises(BadValueError):
b.ls.append(datetime.utcnow())

b1 = B()
b1.ls = [u'hello', u'123']
Expand Down

0 comments on commit 27d2949

Please sign in to comment.