Example #1
0
 def test_coerce_date_dict(self):
     date_dict = coerce_date_dict({
         'year': '2008', 'month': '4', 'day': '2',
         'hour': '4', 'minute': '4', 'second': '4'
     })
     expected = {
         'year': 2008, 'month': 4, 'day': 2,
         'hour': 4, 'minute': 4, 'second': 4
     }
     self.assertEqual(date_dict, expected)
Example #2
0
 def test_coerce_date_dict_missing_values(self):
     self.assertEqual(
         coerce_date_dict({
             'year': '2008',
             'month': '4',
             'hours': '3'
         }), {
             'year': 2008,
             'month': 4,
             'day': 1,
             'hour': 0,
             'minute': 0,
             'second': 0
         })
Example #3
0
 def test_coerce_date_dict_partial(self):
     self.assertEqual(
         coerce_date_dict({
             'year': '2008',
             'month': '4',
             'day': '2'
         }), {
             'year': 2008,
             'month': 4,
             'day': 2,
             'hour': 0,
             'minute': 0,
             'second': 0
         })
 def test_coerce_date_dict_missing_values(self):
     self.assertEqual(
         coerce_date_dict({
             "year": "2008",
             "month": "4",
             "hours": "3"
         }),
         {
             "year": 2008,
             "month": 4,
             "day": 1,
             "hour": 0,
             "minute": 0,
             "second": 0
         },
     )
 def test_coerce_date_dict_partial(self):
     self.assertEqual(
         coerce_date_dict({
             "year": "2008",
             "month": "4",
             "day": "2"
         }),
         {
             "year": 2008,
             "month": 4,
             "day": 2,
             "hour": 0,
             "minute": 0,
             "second": 0
         },
     )
 def test_coerce_date_dict_missing_values(self):
     self.assertEqual(
         coerce_date_dict({'year': '2008', 'month': '4', 'hours': '3'}),
         {'year': 2008, 'month': 4, 'day': 1, 'hour': 0, 'minute': 0, 'second': 0}
     )
 def test_coerce_date_dict_empty(self):
     self.assertEqual(
         coerce_date_dict({}),
         {}
     )
 def test_coerce_date_dict_partial(self):
     self.assertEqual(
         coerce_date_dict({'year': '2008', 'month': '4', 'day': '2'}),
         {'year': 2008, 'month': 4, 'day': 2, 'hour': 0, 'minute': 0, 'second': 0}
     )
Example #9
0
 def test_coerce_date_dict_empty(self):
     self.assertEqual(coerce_date_dict({}), {})
Example #10
0
 def test_coerce_date_dict_empty(self):
     date_dict = coerce_date_dict({})
     expected = {}
     self.assertEqual(date_dict, expected)