MCPcopy
hub / github.com/mikf/gallery-dl / test_wait_until_datetime

Method test_wait_until_datetime

test/test_extractor.py:267–285  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

265 self._assert_isotime(calls[0][1][2], until)
266
267 def test_wait_until_datetime(self):
268 extr = extractor.find("generic:https://example.org/")
269 until = dt.now() + dt.timedelta(seconds=5)
270 until_local = dt.datetime.now() + dt.timedelta(seconds=5)
271
272 if not until.microsecond:
273 until = until.replace(microsecond=until_local.microsecond)
274
275 with patch("time.sleep") as sleep, patch.object(extr, "log") as log:
276 extr.wait(until=until)
277
278 calls = sleep.mock_calls
279 self.assertEqual(len(calls), 1)
280 self.assertAlmostEqual(calls[0][1][0], 6.0, places=1)
281
282 calls = log.info.mock_calls
283 self.assertEqual(len(calls), 1)
284 self.assertEqual(calls[0][1][1], "5 seconds")
285 self._assert_isotime(calls[0][1][2], until_local)
286
287 def _assert_isotime(self, output, until):
288 if not isinstance(until, dt.datetime):

Callers

nothing calls this directly

Calls 4

_assert_isotimeMethod · 0.95
replaceMethod · 0.80
waitMethod · 0.80
assertEqualMethod · 0.80

Tested by

no test coverage detected