Skip to content

Instantly share code, notes, and snippets.

@jsalvet
Created September 3, 2013 08:36
Show Gist options
  • Save jsalvet/6421196 to your computer and use it in GitHub Desktop.
Save jsalvet/6421196 to your computer and use it in GitHub Desktop.
mongoengine DecimalField incorrect validation
import mongoengine
import unittest
class Test(mongoengine.Document):
float = mongoengine.FloatField()
decimal = mongoengine.DecimalField()
class ValidateTestCase(unittest.TestCase):
def test_float(self):
doc = Test(float='something invalid')
self.assertRaises(mongoengine.ValidationError, doc.validate)
def test_decimal(self):
doc = Test(decimal='something invalid')
self.assertRaises(mongoengine.ValidationError, doc.validate)
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment