diff --git a/rbackup/tests/test_hierarchy.py b/rbackup/tests/test_hierarchy.py index 45dc537..bf11ff4 100644 --- a/rbackup/tests/test_hierarchy.py +++ b/rbackup/tests/test_hierarchy.py @@ -1,4 +1,11 @@ import doctest +import unittest + +from hypothesis import given +from hypothesis.strategies import booleans, characters, iterables, one_of, none, text +from pathlib import Path +from rbackup.hierarchy.hierarchy import Hierarchy +from unittest.mock import patch # ========== Constants ========== TESTING_MODULE = "rbackup.hierarchy.hierarchy" @@ -8,3 +15,15 @@ TESTING_MODULE = "rbackup.hierarchy.hierarchy" def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(TESTING_MODULE)) return tests + + +# ========== Tests ========== +class TestHierarchyPaths(unittest.TestCase): + @given(one_of(text(), characters())) + def test_returns_correct_path(self, p): + self.assertEqual(Path(p), Hierarchy(p).path) + + @given(one_of(iterables(elements=none()), booleans())) + def test_raises_value_error(self, p): + with self.assertRaises(TypeError): + Hierarchy(p)