示例#1
0
def test_load_npz():
  path = "./tests/fixtures/arrays.npz"
  arrays = load(path)
  assert isinstance(arrays, np.lib.npyio.NpzFile)
示例#2
0
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)
示例#3
0
def test_load_npy():
  path = "./tests/fixtures/array.npy"
  array = load(path)
  assert array.shape is not None
示例#4
0
def test_load_json():
  path = "./tests/fixtures/dictionary.json"
  dictionary = load(path)
  assert "key" in dictionary
示例#5
0
def test_load_text():
  path = "./tests/fixtures/string.txt"
  string = load(path)
  assert u"🐕" in string
示例#6
0
def test_load_garbage_with_unknown_extension():
    path = "./tests/fixtures/string.XYZ"
    with pytest.raises(RuntimeError):
        load(path)
示例#7
0
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']
示例#9
0
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']