예제 #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')