def test_warehouse_retrieves_specified_packet_range(): warehouse = Warehouse( {'packet_id': {'storage': "some/directory", 'interval': 30, 'pair': 'SMNPAR'}, 'other_pkt': {'storage': "some/directory", 'interval': 60, 'pair': 'SMNPAR'}}) assert warehouse.retrieve('packet_id', since=1500000000, until=1500001000) == Data(from_dir="some/directory/SMNPAR", with_interval=30, with_since=1500000000, with_until=1500001000)
def test_warehouse_raises_an_error_when_accessing_non_existent_packet(): warehouse = Warehouse({}) with pytest.raises(MissingPacketError): warehouse.retrieve("some_packet_id") with pytest.raises(MissingPacketError): warehouse.update("some_packet_id")