def test_load_npz(): path = "./tests/fixtures/arrays.npz" arrays = load(path) assert isinstance(arrays, np.lib.npyio.NpzFile)
def test_load_multiline_text_as_list(): path = "./tests/fixtures/multiline.txt" string_list = load(path, split=True) assert isinstance(string_list, list) assert all(isinstance(string, str) for string in string_list)
def test_load_npy(): path = "./tests/fixtures/array.npy" array = load(path) assert array.shape is not None
def test_load_json(): path = "./tests/fixtures/dictionary.json" dictionary = load(path) assert "key" in dictionary
def test_load_text(): path = "./tests/fixtures/string.txt" string = load(path) assert u"🐕" in string
def test_load_garbage_with_unknown_extension(): path = "./tests/fixtures/string.XYZ" with pytest.raises(RuntimeError): load(path)
def test_load_json_with_file_handle(): path = "./tests/fixtures/dictionary.json" with io.open(path, 'r') as handle: dictionary = load(handle) assert "key" in dictionary
def get_ram(self): fname = self.data_path return load(fname)['ram']
def test_load_image_resized(path): image = load(path) assert image.shape is not None assert all(dimension > 2 for dimension in image.shape)
def get_frames(self): fname = self.data_path return load(fname)['frames']
def get_observations(self): fname = self.data_path return load(fname)['observations']
def get_episode_rewards(self): fname = self.data_path return load(fname)['ep_rewards']
def get_representation(self): fname = self.data_path return load(fname)['representation']
def get_scores(self): fname = self.data_path return load(fname)['score']