def test_test_now(): now = pendulum.datetime(2000, 11, 10, 12, 34, 56, 123456) pendulum.set_test_now(now) assert pendulum.has_test_now() assert now == pendulum.get_test_now() assert_datetime(pendulum.now(), 2000, 11, 10, 12, 34, 56, 123456) pendulum.set_test_now() assert not pendulum.has_test_now() assert pendulum.get_test_now() is None
def _next_timestamp(): if pendulum.has_test_now(): return pendulum.now() nonlocal last_timestamp while last_timestamp == pendulum.now(): pass last_timestamp = pendulum.now() return last_timestamp