Пример #1
0
class TimeDeltaFieldTestCase(TestCase):

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

    def test_clean(self):
        self.assertEqual(self.field.clean('10 dias.'), datetime.timedelta(days=10))

    def test_zero(self):
        self.assertEqual(self.field.clean('0 dias.'), datetime.timedelta(days=0))
class TimeDeltaFieldTestCase(TestCase):

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

    def test_clean(self):
        self.assertEqual(self.field.clean('10 dias.'), datetime.timedelta(days=10))

    def test_zero(self):
        self.assertEqual(self.field.clean('0 dias.'), datetime.timedelta(days=0))

    def test_fail(self):
        with self.assertRaises(ValidationError):
            self.field.clean('2 meses.')
class TimeDeltaFieldTestCase(TestCase):
    def setUp(self):
        self.field = TimeDeltaField()

    def test_clean(self):
        self.assertEqual(self.field.clean('10 dias.'),
                         datetime.timedelta(days=10))

    def test_zero(self):
        self.assertEqual(self.field.clean('0 dias.'),
                         datetime.timedelta(days=0))

    def test_fail(self):
        with self.assertRaises(ValidationError):
            self.field.clean('2 meses.')
 def setUp(self):
     self.field = TimeDeltaField()
 def setUp(self):
     self.field = TimeDeltaField()