def convert_string_to_data_class_action(string_data): try: new_data_shell = DataClassShell(**string_data) new_data_class = DataClass(**new_data_shell.get_data_class()) return new_data_class except StandardError: print("Can not convert string to class", Exception)
def convert_string_to_data_class_action(string_data): try: new_data_shell = DataClassShell(**string_data) new_data_class = DataClass(**new_data_shell.get_data_class()) return new_data_class except StandardError: print("Can not convert string to class", Exception)
def TEST_write_to_new_file(self): my_file = FileService.create_file_at_location("Resources", "tomato") url_path = "Resources/test.json" string_data = FileService.get_object_from_path(url_path) new_data = FileService.convert_string_to_data_class_action(string_data) new_shell = DataClassShell(new_data) FileService.write_to_file(my_file, new_shell.to_json())
def TEST_write_to_new_file(self): my_file = FileService.create_file_at_location("Resources", "tomato") url_path = "Resources/test.json" string_data = FileService.get_object_from_path(url_path) new_data = FileService.convert_string_to_data_class_action(string_data) new_shell = DataClassShell(new_data) FileService.write_to_file(my_file, new_shell.to_json())
def TEST_read_file_as_object(self): url_path = "Resources/test.json" with open(url_path) as json_file: input_object = json.load(json_file) new_data_shell = DataClassShell(**input_object) new_data = DataClass(**new_data_shell.get_data_class()) new_name = new_data.get_name() Log.log(new_name)
def TEST_read_file_as_object(self): url_path = "Resources/test.json" with open(url_path) as json_file: input_object = json.load(json_file) new_data_shell = DataClassShell(**input_object) new_data = DataClass(**new_data_shell.get_data_class()) new_name = new_data.get_name() Log.log(new_name)