(self)
| 2854 | self.assertEqual(d, self.theclass(1969, 12, 31, 23, 59, 58, 950000)) |
| 2855 | |
| 2856 | def test_utcnow(self): |
| 2857 | import time |
| 2858 | |
| 2859 | # Call it a success if utcnow() and utcfromtimestamp() are within |
| 2860 | # a second of each other. |
| 2861 | tolerance = timedelta(seconds=1) |
| 2862 | for dummy in range(3): |
| 2863 | with self.assertWarns(DeprecationWarning): |
| 2864 | from_now = self.theclass.utcnow() |
| 2865 | |
| 2866 | with self.assertWarns(DeprecationWarning): |
| 2867 | from_timestamp = self.theclass.utcfromtimestamp(time.time()) |
| 2868 | if abs(from_timestamp - from_now) <= tolerance: |
| 2869 | break |
| 2870 | # Else try again a few times. |
| 2871 | self.assertLessEqual(abs(from_timestamp - from_now), tolerance) |
| 2872 | |
| 2873 | def test_strptime(self): |
| 2874 | string = '2004-12-01 13:02:47.197' |
nothing calls this directly
no test coverage detected