def test_datasets_iter(client):
    keys = [n for n in range(10)]
    client.publish_dataset(**{str(key): key for key in keys})
    for n, key in enumerate(client.datasets):
        assert key == str(n)
    with pytest.raises(TypeError):
        client.datasets.__aiter__()
def test_datasets_getitem(client):
    for key in ["key", ("key", "key"), 1]:
        value = "value"
        client.publish_dataset(value, name=key)
        assert client.datasets[key] == value
        assert client.datasets.get(key) == value
        assert client.datasets.get(key, default="something else") == value
def test_unpublish_sync(client):
    data = client.scatter([0, 1, 2])
    client.publish_dataset(data=data)
    client.unpublish_dataset(name="data")

    with pytest.raises(KeyError) as exc_info:
        client.get_dataset(name="data")

    assert "not found" in str(exc_info.value)
    assert "data" in str(exc_info.value)
Beispiel #4
0
def test_unpublish_sync(client):
    data = client.scatter([0, 1, 2])
    client.publish_dataset(data=data)
    client.unpublish_dataset(name='data')

    with pytest.raises(KeyError) as exc_info:
        result = client.get_dataset(name='data')

    assert "not found" in str(exc_info.value)
    assert "data" in str(exc_info.value)
def test_unpublish_multiple_datasets_sync(client):
    x = delayed(inc)(1)
    y = delayed(inc)(2)
    client.publish_dataset(x=x, y=y)
    client.unpublish_dataset(name="x")

    with pytest.raises(KeyError) as exc_info:
        client.get_dataset(name="x")

    datasets = client.list_datasets()
    assert set(datasets) == {"y"}

    assert "not found" in str(exc_info.value)
    assert "x" in str(exc_info.value)

    client.unpublish_dataset(name="y")

    with pytest.raises(KeyError) as exc_info:
        client.get_dataset(name="y")

    assert "not found" in str(exc_info.value)
    assert "y" in str(exc_info.value)
Beispiel #6
0
def test_unpublish_multiple_datasets_sync(client):
    x = delayed(inc)(1)
    y = delayed(inc)(2)
    client.publish_dataset(x=x, y=y)
    client.unpublish_dataset(name='x')

    with pytest.raises(KeyError) as exc_info:
        result = client.get_dataset(name='x')

    datasets = client.list_datasets()
    assert set(datasets) == {'y'}

    assert "not found" in str(exc_info.value)
    assert "x" in str(exc_info.value)

    client.unpublish_dataset(name='y')

    with pytest.raises(KeyError) as exc_info:
        result = client.get_dataset(name='y')

    assert "not found" in str(exc_info.value)
    assert "y" in str(exc_info.value)
def test_datasets_republish(client):
    key, value, value2 = "key", "value", "value2"
    client.publish_dataset(key=value)
    assert client.get_dataset(key) == value

    with pytest.raises(KeyError) as exc_info:
        client.publish_dataset(key=value)

    client.publish_dataset(key=value2, override=True)
    assert client.get_dataset(key) == value2
def test_datasets_delitem(client):
    for key in ["key", ("key", "key"), 1]:
        value = "value"
        client.publish_dataset(value, name=key)
        del client.datasets[key]
        assert key not in client.list_datasets()
Beispiel #9
0
def test_datasets_iter(client):
    keys = [n for n in range(10)]
    client.publish_dataset(**{str(key): key for key in keys})
    for n, key in enumerate(client.datasets):
        assert key == str(n)
def test_datasets_delitem(client):
    for key in ['key', ('key', 'key'), 1]:
        value = 'value'
        client.publish_dataset(value, name=key)
        del client.datasets[key]
        assert key not in client.list_datasets()
Beispiel #11
0
def test_datasets_delitem(client):
    for key in ['key', ('key', 'key'), 1]:
        value = 'value'
        client.publish_dataset(value, name=key)
        del client.datasets[key]
        assert key not in client.list_datasets()
Beispiel #12
0
def test_datasets_getitem(client):
    for key in ['key', ('key', 'key'), 1]:
        value = 'value'
        client.publish_dataset(value, name=key)
        assert client.datasets[key] == value
def test_datasets_iter(client):
    keys = [n for n in range(10)]
    client.publish_dataset(**{str(key): key for key in keys})
    for n, key in enumerate(client.datasets):
        assert key == str(n)
def test_datasets_getitem(client):
    for key in ["key", ("key", "key"), 1]:
        value = "value"
        client.publish_dataset(value, name=key)
        assert client.datasets[key] == value
def test_datasets_contains(client):
    key, value = 'key', 'value'
    client.publish_dataset(key=value)
    assert key in client.datasets
def test_datasets_keys(client):
    client.publish_dataset(**{str(n): n for n in range(10)})
    keys = list(client.datasets.keys())
    assert keys == [str(n) for n in range(10)]
def test_datasets_contains(client):
    key, value = "key", "value"
    client.publish_dataset(key=value)
    assert key in client.datasets
Beispiel #18
0
def test_datasets_keys(client):
    client.publish_dataset(**{str(n): n for n in range(10)})
    keys = list(client.datasets.keys())
    assert keys == [str(n) for n in range(10)]
Beispiel #19
0
def test_datasets_contains(client):
    key, value = 'key', 'value'
    client.publish_dataset(key=value)
    assert key in client.datasets
def test_datasets_getitem(client):
    for key in ['key', ('key', 'key'), 1]:
        value = 'value'
        client.publish_dataset(value, name=key)
        assert client.datasets[key] == value