This repository has been archived on 2023-10-03. You can view files and clone it, but cannot push or open issues or pull requests.
blender-cloud-addon/tests/test_utils.py

26 lines
895 B
Python
Raw Permalink Normal View History

2016-10-11 10:52:27 +02:00
"""Unittests for blender_cloud.utils."""
import pathlib
import unittest
from blender_cloud import utils
class FindInPathTest(unittest.TestCase):
def test_nonexistant_path(self):
path = pathlib.Path("/doesnotexistreally")
2016-10-11 10:52:27 +02:00
self.assertFalse(path.exists())
self.assertIsNone(utils.find_in_path(path, "jemoeder.blend"))
2016-10-11 10:52:27 +02:00
def test_really_breadth_first(self):
"""A depth-first test might find dir_a1/dir_a2/dir_a3/find_me.txt first."""
path = pathlib.Path(__file__).parent / "test_really_breadth_first"
found = utils.find_in_path(path, "find_me.txt")
self.assertEqual(path / "dir_b1" / "dir_b2" / "find_me.txt", found)
2016-10-11 10:52:27 +02:00
def test_nonexistant_file(self):
path = pathlib.Path(__file__).parent / "test_really_breadth_first"
found = utils.find_in_path(path, "do_not_find_me.txt")
2016-10-11 10:52:27 +02:00
self.assertEqual(None, found)