Skip to content

Commit

Permalink
Add tests for invalid separators.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 16, 2023
1 parent d22bba2 commit 9cce392
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion zipp/glob.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@


class Translator:
"""
>>> Translator('xyz')
Traceback (most recent call last):
...
AssertionError: Invalid separators
>>> Translator('')
Traceback (most recent call last):
...
AssertionError: Invalid separators
"""

seps: str

def __init__(self, seps: str = _default_seps):
assert seps in ('/', '\\', '\\/')
assert seps and set(seps) <= set(_default_seps), "Invalid separators"
self.seps = seps

def translate(self, pattern):
Expand Down

0 comments on commit 9cce392

Please sign in to comment.