From 50b765ba6f3c52efcdc923afae52efe9a1522ec8 Mon Sep 17 00:00:00 2001 From: Alexey Date: Sat, 12 May 2018 15:37:51 +0300 Subject: [PATCH] Tests for passing filename as Path --- test/test_api.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_api.py b/test/test_api.py index b3a6052..7fe1181 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -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)