Skip to content

Commit 5c81dfa

Browse files
committed
add basic test for mode and strmode properties
1 parent a6e34c1 commit 5c81dfa

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_entry.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This file is part of a program licensed under the terms of the GNU Lesser
2+
# General Public License version 2 (or at your option any later version)
3+
# as published by the Free Software Foundation: http://www.gnu.org/licenses/
4+
5+
6+
from __future__ import division, print_function, unicode_literals
7+
8+
from os import stat
9+
10+
from libarchive import memory_reader, memory_writer
11+
12+
13+
def test_entry_properties():
14+
15+
buf = bytes(bytearray(1000000))
16+
with memory_writer(buf, 'gnutar') as archive:
17+
archive.add_files('README.rst')
18+
19+
with memory_reader(buf) as archive:
20+
for entry in archive:
21+
assert entry.mode == stat('README.rst')[0]
22+
assert b'rw' in entry.strmode

0 commit comments

Comments
 (0)