Add 10 digits validation test on numeric field
issue7091 review37981002
This commit is contained in:
1 parent
b53fcf111a
commit
0eaf7c16b8
1 file changed
+23
@@ -122,6 +122,29 @@ class FieldNumericTestCase(unittest.TestCase):
|
||||
|
||||
self.assertEqual(numeric.numeric, Decimal('0.123456789012345'))
|
||||
|
||||
@with_transaction()
|
||||
def test_create_10_digits(self):
|
||||
"Test create a numeric with 10 digits"
|
||||
Numeric = Pool().get('test.numeric_digits')
|
||||
|
||||
numeric, = Numeric.create([{
|
||||
'digits': 10,
|
||||
'numeric': Decimal('0.04'),
|
||||
}])
|
||||
|
||||
self.assertEqual(numeric.numeric, Decimal('0.04'))
|
||||
|
||||
@with_transaction()
|
||||
def test_create_10_digits_invalid(self):
|
||||
"Test create a numeric with 11 digits on with 10 limit"
|
||||
Numeric = Pool().get('test.numeric_digits')
|
||||
|
||||
with self.assertRaises(UserError):
|
||||
Numeric.create([{
|
||||
'digits': 10,
|
||||
'numeric': Decimal('1.11111111111'),
|
||||
}])
|
||||
|
||||
@with_transaction()
|
||||
def test_search_equals(self):
|
||||
"Test search numeric equals"
|
||||
|
||||
Reference in new issue
Block a user