def test_should_obter_respeitando_format_string(self): s = "2013-01-02T10:21:51 COO:022734" field = DateTimeField(r'^(\d+-\d+-\d+T\d+:\d+:\d+)', format_string='%Y-%m-%dT%H:%M:%S') value = field.parse_block(s) data_esperada = datetime(2013, 1, 2, 10, 21, 51) self.assertEqual(value, data_esperada)
def test_should_return_value(self): s = "02/01/2013 10:21:51 COO:022734" field = DateTimeField(r'^(\d+/\d+/\d+ \d+:\d+:\d+)') value = field.parse_block(s) data_esperada = datetime(2013, 1, 2, 10, 21, 51) self.assertEqual(value, data_esperada)