Skip to content

Commit 4d72c7d

Browse files
committed
test format_name and filter_names
1 parent 84cbf40 commit 4d72c7d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/test_rwx.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def test_buffers(tmpdir):
2626
# Read the archive and check that the data is correct
2727
with libarchive.memory_reader(buf) as archive:
2828
check_archive(archive, tree)
29+
assert archive.format_name == b'GNU tar format'
30+
assert archive.filter_names == [b'xz']
2931

3032
# Extract the archive in tmpdir and check that the data is intact
3133
with in_dir(tmpdir.strpath):
@@ -50,6 +52,8 @@ def test_fd(tmpdir):
5052
archive_file.seek(0)
5153
with libarchive.fd_reader(fd) as archive:
5254
check_archive(archive, tree)
55+
assert archive.format_name == b'GNU tar format'
56+
assert archive.filter_names == [b'bzip2']
5357

5458
# Extract the archive in tmpdir and check that the data is intact
5559
archive_file.seek(0)
@@ -73,6 +77,8 @@ def test_files(tmpdir):
7377
# Read the archive and check that the data is correct
7478
with libarchive.file_reader(archive_path) as archive:
7579
check_archive(archive, tree)
80+
assert archive.format_name == b'POSIX ustar format'
81+
assert archive.filter_names == [b'gzip']
7682

7783
# Extract the archive in tmpdir and check that the data is intact
7884
with in_dir(tmpdir.strpath):
@@ -95,6 +101,8 @@ def test_custom_writer_and_stream_reader():
95101
# Read the archive and check that the data is correct
96102
with libarchive.stream_reader(stream, 'zip') as archive:
97103
check_archive(archive, tree)
104+
assert archive.format_name == b'ZIP 2.0 (deflation)'
105+
assert archive.filter_names == []
98106

99107

100108
@patch('libarchive.ffi.write_fail')

0 commit comments

Comments
 (0)