def test_yaml_read(self): open(os.path.join(self.dir_path, "input.yaml"), "w").write(""" key1: data1 key2: key3: - 1 - 2 """) assert load_json_or_yaml(os.path.join(self.dir_path, "input.yaml")) == {'key1': 'data1', 'key2': {'key3': [1, 2]}}
def get_course_descriptor_content(cls, courseid): """ Returns the content of the dict that describes the course """ return load_json_or_yaml(cls._get_course_descriptor_path(courseid))
def test_yaml_write(self): write_json_or_yaml(os.path.join(self.dir_path, "output.yaml"), {'key1': 'data1', 'key2': {'key3': [1, 2]}}) assert load_json_or_yaml(os.path.join(self.dir_path, "output.yaml")) == {'key1': 'data1', 'key2': {'key3': [1, 2]}}
def test_json_read(self): open(os.path.join(self.dir_path, "input.json"), "w").write('{"key1":"data1","key2":{"key3":[1,2]}}') assert load_json_or_yaml(os.path.join(self.dir_path, "input.json")) == {'key1': 'data1', 'key2': {'key3': [1, 2]}}