def check_write_load(self, orig_data): orig = RegionCollection(**orig_data) orig.writeToFile('test_data') recovered = RegionCollection(filename='test_data') for key in orig_data: self.assertEqual(getattr(recovered, key), orig_data[key]) remove_files(['test_data'], error_on_missing=False)
def test_export_table(self): """correctly generates table file""" orig_data = dict(counts=[[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]], ranks=[0, 1, 2, 3, 4], labels=['a', 'b', 'c', 'd', 'e']) coll = RegionCollection(**orig_data) expect = coll.toTable().getRawData() coll.writeToFile('testdata', as_table=True) got = LoadTable('testdata', sep='\t') self.assertEqual(got.getRawData(), expect) remove_files(['testdata'], error_on_missing=False)