Created
September 3, 2013 08:36
-
-
Save jsalvet/6421196 to your computer and use it in GitHub Desktop.
mongoengine DecimalField incorrect validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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