Skip to content

Commit

Permalink
Add test_4_normalizing_pathlib_paths
Browse files Browse the repository at this point in the history
  • Loading branch information
pykong committed Feb 26, 2020
1 parent 2d14cd7 commit 711bc0a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pathspec/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import tempfile
import unittest

from pathspec.util import iter_tree_entries, iter_tree_files, RecursionError, normalize_file
from pathspec.util import iter_tree_entries, iter_tree_files, RecursionError, normalize_file, normalize_files


class IterTreeTest(unittest.TestCase):
Expand Down Expand Up @@ -370,11 +370,22 @@ def test_3_entries(self):
])))

@unittest.skipIf(sys.version_info < (3, 4), "pathlib entered stdlib in Python 3.4")
def test_4_normalizing_pathlib_paths(self):
def test_4_normalizing_pathlib_path(self):
"""
Tests passing pathlib.Path as argument.
"""
from pathlib import Path
first_spec = normalize_file(Path('a.txt'))
second_spec = normalize_file('a.txt')
self.assertEqual(first_spec, second_spec)

@unittest.skipIf(sys.version_info < (3, 4), "pathlib entered stdlib in Python 3.4")
def test_4_normalizing_pathlib_paths(self):
"""
Tests passing pathlib.Path as argument.
"""
from pathlib import Path
first_spec = normalize_files([Path('a.txt'), Path('b.txt')])
second_spec = normalize_files(['a.txt', 'b.txt'])
self.assertEqual(first_spec, second_spec)

0 comments on commit 711bc0a

Please sign in to comment.