示例#1
0
	def test_price_with_numeric_string_with_dollar_sign(self):
		# self.assertRaisesMessage(ValidationError,_('Not a valid price. 2 decimals maximum and numbers only is allowed.'),v.price, '1246.78$')
		with self.assertRaises(ValidationError) as e:
			v.price('1246.78$')
		exc  = e.exception
		self.assertEqual(exc.code, 'not_price_formatted')
示例#2
0
	def test_price_with_object(self):
		# self.assertRaisesMessage(ValidationError,_('Not a valid price. 2 decimals maximum and numbers only is allowed.'), v.price, object)
		with self.assertRaises(ValidationError) as e:
			v.price(object)
		exc  = e.exception
		self.assertEqual(exc.code, 'not_price_formatted')
示例#3
0
	def test_price_with_numeric_string_correct_decimals(self):
		self.assertEquals(None, v.price('1246.78'))
		self.assertEquals(None, v.price('1245.34'))
		self.assertEquals(None, v.price('12431'))
示例#4
0
	def test_price_with_correct_integer(self):
		self.assertEquals(None, v.price(1246.78))
		self.assertEquals(None, v.price(1245.34))
		self.assertEquals(None, v.price(12431))		
示例#5
0
	def test_price_with_incorrect_integer(self):
		# self.assertRaisesMessage(ValidationError,_('Not a valid price. 2 decimals maximum and numbers only is allowed.'),v.price, 12345.78978)
		with self.assertRaises(ValidationError) as e:
			v.price(12345.78978)
		exc  = e.exception
		self.assertEqual(exc.code, 'not_price_formatted')
示例#6
0
 def test_price_with_correct_integer(self):
     self.assertEquals(None, v.price(1246.78))
     self.assertEquals(None, v.price(1245.34))
     self.assertEquals(None, v.price(12431))
示例#7
0
 def test_price_with_numeric_string_with_dollar_sign(self):
     # self.assertRaisesMessage(ValidationError,_('Not a valid price. 2 decimals maximum and numbers only is allowed.'),v.price, '1246.78$')
     with self.assertRaises(ValidationError) as e:
         v.price('1246.78$')
     exc = e.exception
     self.assertEqual(exc.code, 'not_price_formatted')
示例#8
0
 def test_price_with_numeric_string_correct_decimals(self):
     self.assertEquals(None, v.price('1246.78'))
     self.assertEquals(None, v.price('1245.34'))
     self.assertEquals(None, v.price('12431'))
示例#9
0
 def test_price_with_object(self):
     # self.assertRaisesMessage(ValidationError,_('Not a valid price. 2 decimals maximum and numbers only is allowed.'), v.price, object)
     with self.assertRaises(ValidationError) as e:
         v.price(object)
     exc = e.exception
     self.assertEqual(exc.code, 'not_price_formatted')
示例#10
0
 def test_price_with_incorrect_integer(self):
     # self.assertRaisesMessage(ValidationError,_('Not a valid price. 2 decimals maximum and numbers only is allowed.'),v.price, 12345.78978)
     with self.assertRaises(ValidationError) as e:
         v.price(12345.78978)
     exc = e.exception
     self.assertEqual(exc.code, 'not_price_formatted')