Skip to content

Commit

Permalink
Tests for passing filename as Path
Browse files Browse the repository at this point in the history
  • Loading branch information
WouldYouKindly authored May 12, 2018
1 parent 3863f98 commit 50b765b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ def test_open_psw_late():
rf = rarfile.RarFile('test/files/rar5-psw.rar')
rf.read('stest1.txt', 'password222')

def test_open_pathlib_path():
try:
from pathlib import Path
# Make sure we can open both relative and absolute Paths
rarfile.RarFile(Path('test/files/rar5-psw.rar'))
rarfile.RarFile(Path('test/files/rar5-psw.rar').resolve())
except ImportError:
pass

def test_detection():
eq_(rarfile.is_rarfile('test/files/ctime4.rar.exp'), False)
eq_(rarfile.is_rarfile('test/files/ctime4.rar'), True)
Expand Down

0 comments on commit 50b765b

Please sign in to comment.