コード例 #1
0
ファイル: TestBase.py プロジェクト: jonsan21/INGInious
 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]}}
コード例 #2
0
ファイル: courses.py プロジェクト: GuillaumeDerval/INGInious
 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))
コード例 #3
0
ファイル: TestBase.py プロジェクト: jonsan21/INGInious
 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]}}
コード例 #4
0
ファイル: TestBase.py プロジェクト: jonsan21/INGInious
 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]}}