Пример #1
0
    def test_load_file_default(self):
        """Test default load for text file and h5 file without extension."""
        filename = self.current_dir + '/test_data'
        self.assertRaises(IOError, load_file, filename)

        filename = self.current_dir + '/test_data2'
        default = load_file(filename)
        self.assertEqual(default, ["some text"])
Пример #2
0
 def test_load_file_json(self):
     json_dict = load_file(self.current_dir+'/test_data.json')
     self.assertEqual(json_dict, {'x': [0, 1]})
Пример #3
0
 def test_filetype_option(self):
     filename = self.current_dir + '/test_data'
     hdf = load_file(filename, filetype="hdf")
     self.assertIsInstance(hdf, FileHDFio)
     self.assertEqual(hdf['content/key'], 'value')
Пример #4
0
 def test_load_file_ProjectHDF(self):
     pr = Project(self.current_dir + '/test_pr')
     pr_hdf = load_file(self.current_dir + '/test_data.h5', project=pr)
     self.assertIsInstance(pr_hdf, ProjectHDFio)
     self.assertEqual(pr_hdf['content/key'], 'value')
     pr.remove(enable=True)
Пример #5
0
 def test_load_file_hdf(self):
     hdf = load_file(self.current_dir+'/test_data.h5')
     self.assertIsInstance(hdf, FileHDFio)
     self.assertEqual(hdf['content/key'], 'value')
Пример #6
0
 def test_load_file_csv(self):
     csv = load_file(self.current_dir+'/test_data.csv')
     content = pd.read_csv(self.current_dir+'/test_data.csv')
     self.assertTrue(content.equals(csv))
Пример #7
0
 def test_load_file_stream_txt(self):
     with open(self.current_dir + '/test_data.txt') as f:
         content = f.readlines()
     with open(self.current_dir + '/test_data.txt') as f:
         txt = load_file(f)
     self.assertEqual(txt, content)