コード例 #1
0
ファイル: test_func.py プロジェクト: wwkimball/yamlpath
 def test_get_yaml_multidoc_data_filenotfound_error(
         self, capsys, quiet_logger, force_ruamel_load_keyboardinterrupt):
     yp = get_yaml_editor()
     docs_yielded = 0
     for doc in get_yaml_multidoc_data(yp, quiet_logger, "no-such.file"):
         if not doc and not isinstance(doc, bool):
             docs_yielded += 1
     assert docs_yielded == 0
     captured = capsys.readouterr()
     assert -1 < captured.err.find("File not found")
コード例 #2
0
ファイル: test_func.py プロジェクト: wwkimball/yamlpath
 def test_get_yaml_multidoc_data_composition_error(self, capsys,
                                                   quiet_logger,
                                                   badcmp_yaml_file):
     yp = get_yaml_editor()
     docs_yielded = 0
     for doc in get_yaml_multidoc_data(yp, quiet_logger, badcmp_yaml_file):
         if not doc and not isinstance(doc, bool):
             docs_yielded += 1
     assert docs_yielded == 0
     captured = capsys.readouterr()
     assert -1 < captured.err.find("YAML composition error")
コード例 #3
0
ファイル: test_func.py プロジェクト: wwkimball/yamlpath
 def test_get_yaml_multidoc_data_syntax_error(self, capsys, quiet_logger,
                                              tmp_path_factory,
                                              badsyntax_yaml_file):
     yp = get_yaml_editor()
     docs_yielded = 0
     for doc in get_yaml_multidoc_data(yp, quiet_logger,
                                       badsyntax_yaml_file):
         if not doc and not isinstance(doc, bool):
             docs_yielded += 1
     assert docs_yielded == 0
     captured = capsys.readouterr()
     assert -1 < captured.err.find("YAML syntax error")
コード例 #4
0
ファイル: test_func.py プロジェクト: wwkimball/yamlpath
 def test_get_yaml_multidoc_data_keyboardinterrupt_error(
         self, capsys, quiet_logger, tmp_path_factory,
         force_ruamel_load_keyboardinterrupt):
     yp = get_yaml_editor()
     content = """---
     no: ''
     """
     yaml_file = create_temp_yaml_file(tmp_path_factory, content)
     docs_yielded = 0
     for doc in get_yaml_multidoc_data(yp, quiet_logger, yaml_file):
         if not doc and not isinstance(doc, bool):
             docs_yielded += 1
     assert docs_yielded == 0
     captured = capsys.readouterr()
     assert -1 < captured.err.find("keyboard interrupt")
コード例 #5
0
ファイル: test_func.py プロジェクト: wwkimball/yamlpath
 def test_get_yaml_multidoc_data_duplicateanchor_error(
         self, capsys, quiet_logger, tmp_path_factory):
     yp = get_yaml_editor()
     content = """---
     aliases:
       - &anchor value1
       - &anchor value2
     """
     yaml_file = create_temp_yaml_file(tmp_path_factory, content)
     docs_yielded = 0
     for doc in get_yaml_multidoc_data(yp, quiet_logger, yaml_file):
         if not doc and not isinstance(doc, bool):
             docs_yielded += 1
     assert docs_yielded == 0
     captured = capsys.readouterr()
     assert -1 < captured.err.find("Duplicate YAML Anchor detected")
コード例 #6
0
ファイル: test_func.py プロジェクト: wwkimball/yamlpath
 def test_get_yaml_multidoc_data_construction_error(self, capsys,
                                                    quiet_logger,
                                                    tmp_path_factory):
     yp = get_yaml_editor()
     content = """---
     missing:
       <<:
     """
     yaml_file = create_temp_yaml_file(tmp_path_factory, content)
     docs_yielded = 0
     for doc in get_yaml_multidoc_data(yp, quiet_logger, yaml_file):
         if not doc and not isinstance(doc, bool):
             docs_yielded += 1
     assert docs_yielded == 0
     captured = capsys.readouterr()
     assert -1 < captured.err.find("YAML construction error")