コード例 #1
0
def test_validate_fails():
    complete = TOMLFile(fixtures_dir / "complete.toml")
    content = complete.read()["tool"]["poetry"]
    content["this key is not in the schema"] = ""

    expected = ("Additional properties are not allowed "
                "('this key is not in the schema' was unexpected)")

    assert Factory.validate(content) == {"errors": [expected], "warnings": []}
コード例 #2
0
def test_strict_validation_success_on_multiple_readme_files() -> None:
    with_readme_files = TOMLFile(fixtures_dir / "with_readme_files" /
                                 "pyproject.toml")
    doc: dict[str, Any] = with_readme_files.read()
    content = doc["tool"]["poetry"]

    assert Factory.validate(content, strict=True) == {
        "errors": [],
        "warnings": []
    }
コード例 #3
0
def test_strict_validation_fails_on_readme_files_with_unmatching_types(
) -> None:
    with_readme_files = TOMLFile(fixtures_dir / "with_readme_files" /
                                 "pyproject.toml")
    doc: dict[str, Any] = with_readme_files.read()
    content = doc["tool"]["poetry"]
    content["readme"][0] = "README.md"

    assert Factory.validate(content, strict=True) == {
        "errors": [
            "Declared README files must be of same type: found text/markdown,"
            " text/x-rst"
        ],
        "warnings": [],
    }
コード例 #4
0
ファイル: test_factory.py プロジェクト: OhMyBuggg/poetry-core
def test_validate():
    complete = PyProjectTOMLFile(fixtures_dir / "complete.toml")
    content = complete.read()["tool"]["poetry"]

    assert Factory.validate(content) == {"errors": [], "warnings": []}
コード例 #5
0
def test_validate() -> None:
    complete = TOMLFile(fixtures_dir / "complete.toml")
    doc: dict[str, Any] = complete.read()
    content = doc["tool"]["poetry"]

    assert Factory.validate(content) == {"errors": [], "warnings": []}