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": []}
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": [] }
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": [], }
def test_validate(): complete = PyProjectTOMLFile(fixtures_dir / "complete.toml") content = complete.read()["tool"]["poetry"] assert Factory.validate(content) == {"errors": [], "warnings": []}
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": []}