rbackup/tests/test_hierarchy.py
2019-04-10 18:03:58 -07:00

27 lines
770 B
Python

import json
import unittest
from io import StringIO
from pathlib import Path
from unittest.mock import PropertyMock, patch
from hypothesis import given
from hypothesis.strategies import characters, one_of, lists, text
from rbackup.struct.hierarchy import Hierarchy
# ========== Constants ==========
TESTING_PACKAGE = "rbackup.struct"
TESTING_MODULE = f"{TESTING_PACKAGE}.hierarchy"
# ========== 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)