Exemple #1
0
 def test_if_returns_good_values_on_good_input_date(self):
     test_start = "2016-10-07 00:00"
     test_stop = "2016-10-07 23:59"
     format = "%Y-%m-%d %H:%M"
     start, stop = parse_date("2016-10-07")
     self.assertEqual(start.strftime(format), test_start)
     self.assertEqual(stop.strftime(format), test_stop)
Exemple #2
0
 def test_if_returns_good_values_on_good_input_year(self):
     test_start = "2016-10-07 12:20"
     test_stop = "2010-10-07 12:20"
     format = "%Y-%m-%d %H:%M"
     with mock.patch("ftpfind.datetime") as mock_datetime:
         mock_datetime.datetime.now.return_value = datetime.datetime(2016, 10, 7, 12, 20, 0)
         mock_datetime.side_effects = lambda *args, **kw: date(*args, **kw)
         start, stop = parse_date("6y")
         self.assertEqual(start.strftime(format), test_start)
         self.assertEqual(stop.strftime(format), test_stop)
Exemple #3
0
 def test_if_raises_error_on_bad_input(self):
     with self.assertRaises(ValueError):
         start, stop = parse_date("test")