예제 #1
0
    def test_get(self, update, request, ref_path, view, output, flatten,
                 prune):
        result = Result(ref_path / '4grains2x4x3_compressionY.hdf5')
        for key, value in view.items():
            result = result.view(key, value)

        fname = request.node.name
        cur = result.get(output, flatten, prune)
        if update:
            with bz2.BZ2File((ref_path / 'get' / fname).with_suffix('.pbz2'),
                             'w') as f:
                pickle.dump(cur, f)

        with bz2.BZ2File((ref_path / 'get' / fname).with_suffix('.pbz2')) as f:
            ref = pickle.load(f)
            assert cur is None if ref is None else dict_equal(cur, ref)
예제 #2
0
def default(tmp_path, ref_path):
    """Small Result file in temp location for modification."""
    fname = '12grains6x7x8_tensionY.hdf5'
    shutil.copy(ref_path / fname, tmp_path)
    f = Result(tmp_path / fname)
    return f.view('times', 20.0)