Python hypothesis.strategies.datetimes() Examples

The following are 3 code examples of hypothesis.strategies.datetimes(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module hypothesis.strategies , or try the search function .
Example #1
Source File: test_predictors.py    From orbit-predictor with MIT License 5 votes vote down vote up
def equatorial_orbits(
    draw,
    sma=floats(R_E_KM, 42000),
    ecc=floats(0, 1, exclude_max=True),
    argp=floats(0, 360),
    ta=floats(0, 360),
    epoch=datetimes(),
):
    return KeplerianPredictor(
        draw(sma), draw(ecc), 0, 0, draw(argp), draw(ta), draw(epoch),
    ) 
Example #2
Source File: test_service.py    From txacme with MIT License 5 votes vote down vote up
def panicing_certs_fixture(draw):
    now = draw(datetimes(
        min_value=datetime(1971, 1, 1), max_value=datetime(2030, 1, 1)))
    panic = timedelta(seconds=draw(
        s.integers(min_value=60, max_value=60 * 60 * 24)))
    certs = dict(
        draw(
            s.lists(
                panicing_cert(now, panic),
                min_size=1,
                max_size=5,
                unique_by=lambda i: i[0])))
    return AcmeFixture(now=now, panic_interval=panic, certs=certs) 
Example #3
Source File: test_prettyprinter.py    From prettyprinter with MIT License 5 votes vote down vote up
def primitives():
    return (
        st.integers() |
        st.floats(allow_nan=False) |
        st.text() |
        st.binary() |
        st.datetimes(timezones=timezones() | st.none()) |
        st.dates() |
        st.times(timezones=timezones() | st.none()) |
        st.timedeltas() |
        st.booleans() |
        st.none()
    )