Esempio n. 1
0
def cross_timezone(testcase: TestCase, gen_timezone, gen_seq_factory,
                   poll_timezone, poll_seq_factory, strict):
    mocked_gen_dt = Replace(token_datetime, test_datetime(tzinfo=gen_timezone, strict=strict, delta=0))
    mocked_poll_dt = Replace(token_datetime, test_datetime(tzinfo=poll_timezone, strict=strict, delta=0))
    def mixed_seq():
        with mocked_gen_dt as d:
            next(gen_seq_factory(d))
            yield
        with mocked_poll_dt as d:
            poll_seq = poll_seq_factory(d)
            next(poll_seq)  # skip first entry
            yield from poll_seq

    with testcase.subTest(tz1=gen_timezone, tz2=poll_timezone):
        yield mixed_seq()
Esempio n. 2
0
def dateseq_test(testcase: TestCase, timezone, seq_factory, strict):
    mocked_dt = Replace(token_datetime, test_datetime(tzinfo=timezone, strict=strict, delta=0))
    with mocked_dt as d, testcase.subTest(tz=timezone):
        yield seq_factory(d)