def test_load_json_file_file_format_error(self): json_tmp_file = "tests/data/tmp.json" # create empty file with open(json_tmp_file, 'w') as f: f.write("") with self.assertRaises(FileFormatError): testcase._load_json_file(json_tmp_file) os.remove(json_tmp_file) # create empty json file with open(json_tmp_file, 'w') as f: f.write("{}") with self.assertRaises(FileFormatError): testcase._load_json_file(json_tmp_file) os.remove(json_tmp_file) # create invalid format json file with open(json_tmp_file, 'w') as f: f.write("abc") with self.assertRaises(FileFormatError): testcase._load_json_file(json_tmp_file) os.remove(json_tmp_file)