コード例 #1
0
def test_iterates_incomplete_dataset():

    key_paths = ["keys"]
    f = {"keys": {"incomplete": Dataset.incomplete_dataset()}}
    kf = KeyFollower.Follower(f, key_paths, timeout=0.1)
    current_key = 0
    for key in kf:
        current_key += 1
    assert current_key == 25
コード例 #2
0
def test_update_changes_shape():
    key_paths = ["keys"]
    f = {"keys": {"small_incomplete": Dataset.small_incomplete_dataset()}}
    kf = KeyFollower.Follower(f, key_paths, timeout=0.1)
    current_key = 0
    for i in range(5):
        next(kf)
        current_key += 1
    kf.hdf5_file = {"keys": {"small_incomplete": Dataset.complete_dataset()}}
    for key in kf:
        current_key += 1
    assert current_key == 50
コード例 #3
0
def test_index_independent_of_key_value():
    key_paths = ['keys']
    f = {
        "keys": {
            "small_incomplete": Dataset.complete_dataset_random_integers()
        }
    }
    current_key = 0
    kf = KeyFollower.Follower(f, key_paths, timeout=0.1)
    for key in kf:
        assert current_key == key
        current_key += 1
コード例 #4
0
def test_reads_updates():
    key_paths = ["keys"]
    f = {"keys": {"incomplete": Dataset.incomplete_dataset()}}
    kf = KeyFollower.Follower(f, key_paths, timeout=0.1)
    current_key = 0
    for i in range(5):
        next(kf)
        current_key += 1
    kf.hdf5_file = {"keys": {"updating": Dataset.complete_dataset()}}

    for key in kf:
        current_key += 1

    assert current_key == 50