def test_isatab2json_convert_source_split_with_error(self): test_case = 'TEST-ISA-source-split-with-error' actual_json = isatab2json.convert(os.path.join(self._tab_data_dir, test_case), validate_first=False) with open(os.path.join(self._json_data_dir, test_case + '.json')) as expected_file: expected_json = json.load(expected_file) self.assertTrue(utils.assert_json_equal(expected_json, actual_json))
def test_isatab2json_convert_sample_pool(self): test_case = 'TEST-ISA-sample-pool' actual_json = isatab2json.convert(os.path.join(self._tab_data_dir, test_case), validate_first=False) with open(os.path.join(self._json_data_dir, test_case + '.json')) as expected_file: expected_json = json.load(expected_file) self.assertTrue(utils.assert_json_equal(expected_json, actual_json))
def test_isatab2json_convert_charac_param_factor(self): test_case = 'TEST-ISA-charac-param-factor' actual_json = isatab2json.convert(os.path.join(self._tab_data_dir, test_case), validate_first=False) with open(os.path.join(self._json_data_dir, test_case + '.json')) as expected_file: expected_json = json.load(expected_file) self.assertTrue(utils.assert_json_equal(expected_json, actual_json))
def test_json2isatab_isatab2json_2way_convert_source_split(self): test_case = 'TEST-ISA-source-split' with open(os.path.join(self._json_data_dir, test_case + '.json')) as test_json: json2isatab.convert(test_json, self._tmp_dir, validate_first=False) test_json.seek(0) # reset pointer expected_json = json.load(test_json) actual_json = isatab2json.convert(self._tmp_dir, validate_first=False) self.assertTrue(utils.assert_json_equal(expected_json, actual_json))
def test_isatab2json_convert_bii_s_7(self): test_case = 'BII-S-7' actual_json = isatab2json.convert(os.path.join(self._tab_data_dir, test_case), validate_first=False) with open( os.path.join(self._json_data_dir, test_case, test_case + '.json')) as expected_file: expected_json = json.load(expected_file) self.assertTrue(utils.assert_json_equal(expected_json, actual_json))
def test_isatab2json_convert_mtbls1(self): test_case = 'MTBLS1' actual_json = isatab2json.convert(os.path.join(self._tab_data_dir, test_case), self.identifier_type, validate_first=False) with open( os.path.join(self._json_data_dir, test_case, test_case + '.json')) as expected_file: expected_json = json.load(expected_file) self.assertTrue(utils.assert_json_equal(expected_json, actual_json))
def test_isatab2cedar_convert_mtbls2(self): test_case = 'MTBLS2' isa2cedar = ISATab2CEDAR("http://www.isa-tools.org/") isa2cedar.createCEDARjson(os.path.join(self._tab_data_dir, test_case), self._tmp_dir, True) with open(os.path.join(self._json_data_dir, 'cedar', test_case + '.json')) as expected_file, \ open(os.path.join(self._tmp_dir, test_case + '.json')) as actual_file: expected_json = json.load(expected_file) actual_json = json.load(actual_file) utils.strip_ids(expected_json) utils.strip_ids(actual_json) self.assertTrue(utils.assert_json_equal(expected_json, actual_json))
def test_assert_json_equal(self): self.assertTrue(utils.assert_json_equal(self.j1, self.j2)) self.assertFalse(utils.assert_json_equal(self.j1, self.j3))