コード例 #1
0
ファイル: test_util.py プロジェクト: mortonjt/biom-format
    def test_biom_open_gz(self):
        with biom_open(get_data_path('test.json.gz')) as f:
            self.assertTrue(isinstance(f, gzip.GzipFile))

        with biom_open(get_data_path('test_writing.json.gz'), 'w') as f:
            self.assertTrue(isinstance(f, gzip.GzipFile))

        remove(get_data_path('test_writing.json.gz'))
コード例 #2
0
ファイル: test_util.py プロジェクト: mortonjt/biom-format
    def test_biom_open_hdf5(self):
        with biom_open(get_data_path('test.biom')) as f:
            self.assertTrue(isinstance(f, h5py.File))

        with biom_open(get_data_path('test_writing.biom'), 'w') as f:
            self.assertTrue(isinstance(f, h5py.File))

        remove(get_data_path('test_writing.biom'))
コード例 #3
0
ファイル: test_util.py プロジェクト: TankMermaid/biom-format
    def test_biom_open_hdf5(self):
        with biom_open(get_data_path('test.biom')) as f:
            self.assertTrue(isinstance(f, h5py.File))

        with biom_open(get_data_path('test_writing.biom'), 'w') as f:
            self.assertTrue(isinstance(f, h5py.File))

        remove(get_data_path('test_writing.biom'))
コード例 #4
0
ファイル: test_util.py プロジェクト: smdabdoub/biom-format
    def test_biom_open_gz(self):
        with biom_open(get_data_path('test.json.gz')) as f:
            self.assertTrue(isinstance(f, gzip.GzipFile))

        with biom_open(get_data_path('test_writing.json.gz'), 'w') as f:
            self.assertTrue(isinstance(f, gzip.GzipFile))

        remove(get_data_path('test_writing.json.gz'))
コード例 #5
0
ファイル: test_util.py プロジェクト: stevendbrown/biom-format
    def test_load_classic(self):
        tab = load_table(get_data_path('test.json'))
        with NamedTemporaryFile(mode='w') as fp:
            fp.write(str(tab))
            fp.flush()

            obs = load_table(fp.name)

        npt.assert_equal(obs.ids(), tab.ids())
        npt.assert_equal(obs.ids(axis='observation'),
                         tab.ids(axis='observation'))
        npt.assert_equal(obs.matrix_data.toarray(), tab.matrix_data.toarray())
コード例 #6
0
ファイル: test_util.py プロジェクト: mortonjt/biom-format
 def test_biom_open_json(self):
     with biom_open(get_data_path('test.json')) as f:
         self.assertTrue(isinstance(f, file))
コード例 #7
0
ファイル: test_util.py プロジェクト: TankMermaid/biom-format
 def test_is_hdf5_file(self):
     self.assertTrue(is_hdf5_file(get_data_path('test.biom')))
     self.assertFalse(is_hdf5_file(get_data_path('test.json')))
コード例 #8
0
ファイル: test_util.py プロジェクト: TankMermaid/biom-format
 def test_load_table_unicode(self):
     t = load_table(get_data_path('bad_table.txt'))
     self.assertEqual(u's__Cortinarius grosmornënsis',
                      t.metadata('otu1', 'observation')['taxonomy'])
コード例 #9
0
ファイル: test_util.py プロジェクト: TankMermaid/biom-format
 def test_biom_open_json(self):
     with biom_open(get_data_path('test.json')) as f:
         self.assertTrue(hasattr(f, 'read'))
コード例 #10
0
ファイル: test_util.py プロジェクト: TankMermaid/biom-format
 def test_biom_open_hdf5_no_h5py(self):
     with self.assertRaises(RuntimeError):
         with biom_open(get_data_path('test.biom')) as f:
             pass
コード例 #11
0
ファイル: test_util.py プロジェクト: TankMermaid/biom-format
 def test_biom_open_empty(self):
     with self.assertRaises(ValueError) as e:
         with biom_open(get_data_path('no-contents.biom'), 'r') as f:
             pass
     self.assertTrue("is empty and can't be parsed" in str(e.exception))
コード例 #12
0
ファイル: test_util.py プロジェクト: antgonza/biom-format
 def test_is_hdf5_file(self):
     self.assertTrue(is_hdf5_file(get_data_path('test.biom')))
     self.assertFalse(is_hdf5_file(get_data_path('test.json')))
コード例 #13
0
ファイル: test_util.py プロジェクト: antgonza/biom-format
 def test_biom_open_hdf5_no_h5py(self):
     with self.assertRaises(RuntimeError):
         with biom_open(get_data_path('test.biom')) as f:
             pass
コード例 #14
0
ファイル: test_util.py プロジェクト: Nan-Shen/biom-format
 def test_biom_open_json(self):
     with biom_open(get_data_path("test.json")) as f:
         self.assertTrue(hasattr(f, "read"))
コード例 #15
0
ファイル: test_util.py プロジェクト: Nan-Shen/biom-format
 def test_biom_open_empty(self):
     with self.assertRaises(ValueError) as e:
         with biom_open(get_data_path("no-contents.biom"), "r") as f:
             pass
     self.assertTrue("is empty and can't be parsed" in str(e.exception))
コード例 #16
0
 def test_biom_open_json(self):
     with biom_open(get_data_path('test.json')) as f:
         self.assertTrue(isinstance(f, file))