예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 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)