示例#1
0
def test_instantiating_base_class_raises_error():
    """
    Instantiating flowmachine.Query raises an error.
    """

    with pytest.raises(TypeError):
        Query()
示例#2
0
def test_retrieve_all():
    """
    Test that Query.get_stored returns everything.

    """
    dl1 = daily_location("2016-01-01")
    dl1.store().result()
    hl1 = ModalLocation(daily_location("2016-01-01"),
                        daily_location("2016-01-02"))
    hl1.store().result()
    hl2 = ModalLocation(daily_location("2016-01-03"),
                        daily_location("2016-01-04"))
    flow = Flows(hl1, hl2)
    flow.store().result()

    from_cache = [obj.query_id for obj in Query.get_stored()]
    assert dl1.query_id in from_cache
    assert hl1.query_id in from_cache
    assert flow.query_id in from_cache