コード例 #1
0
 def test_datetime_object(self):
     """
     Pass a datetime object. Should get a string back in ISO format.
     """
     now = datetime.now()
     expected_output = now.isoformat()
     actual_output = cast_datetime_filter(now)
     self.assertEqual(actual_output, expected_output)
コード例 #2
0
 def test_non_iso_string(self):
     """
     Pass a string that's not in ISO format. Should get a string back
     that's in ISO format.
     """
     date_string = '08-03-2010'
     expected_iso = cast_datetime_filter(date_string)
     self.assertEqual(expected_iso, '2010-08-03T00:00:00')
コード例 #3
0
    def test_datetime_object(self):
        """Pass a datetime object. Should get a string back in ISO format.

        """
        now = datetime.now()
        expected_output = now.isoformat()
        actual_output = cast_datetime_filter(now)
        self.assertEqual(actual_output, expected_output)
コード例 #4
0
    def test_non_iso_string(self):
        """Pass a string that's not in ISO format.

        Should get a string back that's in ISO format.

        """
        date_string = '08-03-2010'
        expected_iso = cast_datetime_filter(date_string)
        self.assertEqual(expected_iso, '2010-08-03T00:00:00')
コード例 #5
0
 def test_int(self):
     """
     Pass an int. Should raise a `ValueError`
     """
     with self.assertRaises(ValueError):
         cast_datetime_filter(1)
コード例 #6
0
    def test_int(self):
        """Pass an int. Should raise a `ValueError`

        """
        with self.assertRaises(ValueError):
            cast_datetime_filter(1)