class PriceFieldTestCase(TestCase):
    def setUp(self):
        self.field = PriceField()

    def test_price_field(self):
        self.assertRaises(ValidationError, self.field.clean, '10€')

    def test_cents(self):
        self.assertEqual(self.field.clean('10,34 €'), 1034)

    def test_with_period(self):
        self.assertEqual(self.field.clean('1.000,00 €'), 100000)

    def test_double_period(self):
        self.assertEqual(self.field.clean('1.000.234,00 €'), 100023400)
class PriceFieldTestCase(TestCase):

    def setUp(self):
        self.field = PriceField()

    def test_price_field(self):
        self.assertRaises(ValidationError, self.field.clean, '10€')

    def test_cents(self):
        self.assertEqual(self.field.clean('10,34 €'), 1034)

    def test_with_period(self):
        self.assertEqual(self.field.clean('1.000,00 €'), 100000)

    def test_double_period(self):
        self.assertEqual(self.field.clean('1.000.234,00 €'), 100023400)
Esempio n. 3
0
    def _hasher(self, instance):
        date_field = DateField(input_formats=["%d-%m-%Y"])

        # e.g. tender 81558 has no price set
        price = None
        if instance['basePrice'] is not None:
            price = PriceField(required=False).clean(instance['basePrice'])

        return instance['id'], price, \
            date_field.clean(instance['drPublicationDate'])
 def setUp(self):
     self.field = PriceField()
Esempio n. 5
0
 def _hasher(self, instance):
     date_field = DateField(input_formats=["%d-%m-%Y"], required=False)
     return instance['id'], \
         PriceField().clean(instance['initialContractualPrice']), \
         date_field.clean(instance['signingDate'])
 def setUp(self):
     self.field = PriceField()