def test_round_trip(self): with open(os.path.join(this_directory, "example_0.7.json")) as fp: data_in = json.load(fp) record = serialization.build_record(data_in) data_out = json.loads(serialization.encode_record(record, indent=2)) # tags in records are a set, hence have arbitrary order. self.assertTrue("tags" in data_out) data_in["tags"] = sorted(data_in["tags"]) data_out["tags"] = sorted(data_out["tags"]) self.assertEqual(data_in, data_out)
def test_round_trip(self): with open(os.path.join(this_directory, "example_0.7.json")) as fp: data_in = json.load(fp) record = serialization.build_record(data_in) data_out = json.loads(serialization.encode_record(record, indent=2)) # tags in records are a set, hence have arbitrary order. self.assertTrue('tags' in data_out) data_in['tags'] = sorted(data_in['tags']) data_out['tags'] = sorted(data_out['tags']) self.assertEqual(data_in, data_out)
def test_build_record_v0p6(self): with open(os.path.join(this_directory, "example_0.6.json")) as fp: record = serialization.build_record(json.load(fp)) self.assertEqual(record.label, "haggling")
def test_round_trip(self): with open("example_0.6.json") as fp: data_in = json.load(fp) record = serialization.build_record(data_in) data_out = json.loads(serialization.encode_record(record, indent=2)) self.assertEqual(data_in, data_out)
def test_build_record_v0p5(self): with open("example_0.5.json") as fp: record = serialization.build_record(json.load(fp)) self.assertEqual(record.label, "haggling")