Exemple #1
0
    def test_replace(self, tmp_path, pattern, old_content, new_content):
        path = tmp_path / "pyproject.toml"
        path.write_text(old_content)

        pattern = VersionPattern(str(path), pattern)
        pattern.replace("-")

        assert path.read_text() == new_content
Exemple #2
0
    def test_parse(self, tmp_path, pattern, content, hits):
        path = tmp_path / "pyproject.toml"
        path.write_text(content)

        pattern = VersionPattern(str(path), pattern)
        assert pattern.parse() == hits
Exemple #3
0
 def test_from_pattern(self, str, path, pattern):
     p = VersionPattern.from_pattern(str)
     assert p.path == path
     assert p.pattern == pattern