Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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'))
Exemplo n.º 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))		
Exemplo n.º 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')
Exemplo n.º 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))
Exemplo n.º 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')
Exemplo n.º 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'))
Exemplo n.º 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')
Exemplo n.º 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')