Repository navigation
Lots of tests failures with libmagic #36
Copy link
Copy link
Open
Description
Environment:
- Python 3.12.0rc1
- Fedora Rawhide
- libmagic 5.45
- typecode 30.0.1
So after managing to plug ibmagic into this, a lot of assertions are failing:
============================= test session starts ==============================
platform linux -- Python 3.12.0rc1, pytest-7.4.0, pluggy-1.2.0
rootdir: /builddir/build/BUILD/typecode-30.0.1
configfile: pyproject.toml
collected 193 items
src/typecode/pygments_lexers.py . [ 0%]
tests/test_contenttype.py ............Fs..F...FF..x [ 13%]
tests/test_entropy.py .. [ 14%]
tests/test_extractible.py . [ 15%]
tests/test_magic2.py . [ 15%]
tests/test_skeleton_codestyle.py . [ 16%]
tests/test_types.py ........................F..FF......F................ [ 43%]
..........F.....FF....F...F...............F......F..........F.....FF.FFF [ 80%]
.....F........FF.F.................... [100%]
=================================== FAILURES ===================================
________________ TestContentTypeComplex.test_compiled_python_1 _________________
self = <test_contenttype.TestContentTypeComplex testMethod=test_compiled_python_1>
def test_compiled_python_1(self):
test_dir = self.extract_test_zip('contenttype/compiled/python/compiled.zip')
test_file = os.path.join(test_dir, 'command.pyc')
assert get_filetype(test_file) == 'python 2.5 byte-compiled'
assert not is_source(test_file)
assert not is_text(test_file)
expected_mime = (
'application/octet-stream',
# libmagic 5.39
'text/x-bytecode.python',
)
> assert get_mimetype_file(test_file) in expected_mime
E AssertionError: assert 'application/x-bytecode.python' in ('application/octet-stream', 'text/x-bytecode.python')
E + where 'application/x-bytecode.python' = get_mimetype_file('/tmp/scancode-tk-tests -bkoe2157/91zn8ilj/compiled.zip/command.pyc')
tests/test_contenttype.py:259: AssertionError
________________ TestContentTypeComplex.test_doc_postscript_eps ________________
self = <test_contenttype.TestContentTypeComplex testMethod=test_doc_postscript_eps>
def test_doc_postscript_eps(self):
test_file = self.get_test_loc('contenttype/doc/postscript/Image1.eps')
assert is_binary(test_file)
results = dict(
get_filetype_file=get_filetype_file(test_file),
get_mimetype_file=get_mimetype_file(test_file),
)
if on_windows:
expected = dict(
get_filetype_file='DOS EPS Binary File Postscript starts at byte 32 length 466 TIFF starts at byte 498 length 11890',
get_mimetype_file='application/octet-stream',
)
else:
expected = dict(
get_filetype_file='DOS EPS Binary File Postscript starts at byte 32 length 466 TIFF starts at byte 498 length 11890',
get_mimetype_file='image/x-eps',
)
> assert results == expected
E AssertionError: assert {'get_filetyp...'image/x-eps'} == {'get_filetyp...'image/x-eps'}
E Omitting 1 identical items, use -vv to show
E Differing items:
E {'get_filetype_file': 'DOS EPS Binary File at byte 32 length 466 \\012- PostScript document text conforming DSC level ..., little-endian, direntries=13, height=300, bps=1, compression=none, PhotometricInterpretation=BlackIsZero, width=300'} != {'get_filetype_file': 'DOS EPS Binary File Postscript starts at byte 32 length 466 TIFF starts at byte 498 length 11890'}
E Use -v to get more diff
tests/test_contenttype.py:297: AssertionError
__________________ TestContentTypeComplex.test_package_debian __________________
self = <test_contenttype.TestContentTypeComplex testMethod=test_package_debian>
def test_package_debian(self):
test_file = self.get_test_loc('contenttype/package/wget-el_0.5.0-8_all.deb')
expected = (
# libmagic 5.38
'debian binary package (format 2.0), with control.tar.gz, data compression gz',
# libmagic 5.2x
'debian binary package (format 2.0)',
)
> assert get_filetype(test_file) in expected
E AssertionError: assert 'debian binary package (format 2.0), with control.tar.gz , data compression gz' in ('debian binary package (format 2.0), with control.tar.gz, data compression gz', 'debian binary package (format 2.0)')
E + where 'debian binary package (format 2.0), with control.tar.gz , data compression gz' = get_filetype('/builddir/build/BUILD/typecode-30.0.1/tests/data/contenttype/package/wget-el_0.5.0-8_all.deb')
tests/test_contenttype.py:324: AssertionError
___________________ TestContentTypeComplex.test_package_json ___________________
self = <test_contenttype.TestContentTypeComplex testMethod=test_package_json>
def test_package_json(self):
test_file = self.get_test_loc('contenttype/package/package.json')
expected = (
'ascii text, with very long lines',
# libmagic 5.39+
'json data',
)
> assert get_filetype(test_file) in expected
E AssertionError: assert 'json text data' in ('ascii text, with very long lines', 'json data')
E + where 'json text data' = get_filetype('/builddir/build/BUILD/typecode-30.0.1/tests/data/contenttype/package/package.json')
tests/test_contenttype.py:146: AssertionError
_________ TestFileTypesDataDriven.test_filetest_binary_windows_dll_24 __________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6c7a0>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'PE32+ executable (DLL) (Control Panel Item) x86-64, for MS Windows, 3 sections', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'PE32+ executable (DLL) x86-64, for MS Windows', 'mimetype_file': 'application/x-dosexec.../windows.dll.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/binary/windows.dll'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'PE32+ executable (DLL) (Control Panel Item) x86-64, for MS Windows, 3 sections', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/binary/windows.dll.yml', 'elf_type': '', 'filetype_file': 'PE32+ executable (DLL) x86-64, for MS Windows', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...Windows', ...}\n~Omitting 37 identical items, use -vv to show\n~Dif...ile': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/binary/windows.dll'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...Windows', ...}\n~Omitting 37 identical items, use -vv to sho...ile': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/binary/windows.dll'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...Windows', ...}
E Omitting 37 identical items, use -vv to show
E Differing items:
E {'mimetype_file': 'application/vnd.microsoft.portable-executable'} != {'mimetype_file': 'application/x-dosexec'}
E {'filetype_file': 'PE32+ executable (DLL) (Control Panel Item) x86-64, for MS Windows, 3 sections'} != {'filetype_file': 'PE32+ executable (DLL) x86-64, for MS Windows'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/binary/windows.dll.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/binary/windows.dll'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
_________ TestFileTypesDataDriven.test_filetest_build_ar_er_css_map_27 _________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6caa0>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'JSON text data', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'JSON data', 'mimetype_file': 'application/json', 'mimetype_python': '', 'filetype_pygme...-ER.css.map.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.css.map'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'JSON text data', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.css.map.yml', 'elf_type': '', 'filetype_file': 'JSON data', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...ON data', ...}\n~Omitting 38 identical items, use -vv to show\n~Dif...le': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.css.map'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...ON data', ...}\n~Omitting 38 identical items, use -vv to sho...le': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.css.map'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...ON data', ...}
E Omitting 38 identical items, use -vv to show
E Differing items:
E {'filetype_file': 'JSON text data'} != {'filetype_file': 'JSON data'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.css.map.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.css.map'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
_________ TestFileTypesDataDriven.test_filetest_build_ar_er_js_map_28 __________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6cb90>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'JSON text data', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'JSON data', 'mimetype_file': 'application/json', 'mimetype_python': '', 'filetype_pygme...ar-ER.js.map.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.js.map'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'JSON text data', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.js.map.yml', 'elf_type': '', 'filetype_file': 'JSON data', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...ON data', ...}\n~Omitting 38 identical items, use -vv to show\n~Dif...ile': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.js.map'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...ON data', ...}\n~Omitting 38 identical items, use -vv to sho...ile': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.js.map'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...ON data', ...}
E Omitting 38 identical items, use -vv to show
E Differing items:
E {'filetype_file': 'JSON text data'} != {'filetype_file': 'JSON data'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.js.map.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/build/ar-ER.js.map'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
_______ TestFileTypesDataDriven.test_filetest_certificate_eclipse_rsa_35 _______
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6d280>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'DER Encoded PKCS#7 Signed Data', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'data', 'mimetype_file': 'application/octet-stream', 'mimetype_python': '', 'filetype_py...PSE.RSA.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/certificate/ECLIPSE.RSA'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'DER Encoded PKCS#7 Signed Data', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/certificate/ECLIPSE.RSA.yml', 'elf_type': '', 'filetype_file': 'data', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...: 'data', ...}\n~Omitting 37 identical items, use -vv to show\n~Dif... 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/certificate/ECLIPSE.RSA'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...: 'data', ...}\n~Omitting 37 identical items, use -vv to sho... 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/certificate/ECLIPSE.RSA'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...: 'data', ...}
E Omitting 37 identical items, use -vv to show
E Differing items:
E {'filetype_file': 'DER Encoded PKCS#7 Signed Data'} != {'filetype_file': 'data'}
E {'is_data': False} != {'is_data': True}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/certificate/ECLIPSE.RSA.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/certificate/ECLIPSE.RSA'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
____ TestFileTypesDataDriven.test_filetest_code_scala_applicative_scala_62 _____
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6e600>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'Unicode text, UTF-8 text', 'filetype_pygment': 'Scala', ...}
expected = OrderedDict({'filetype_file': 'UTF-8 Unicode text', 'mimetype_file': 'text/plain', 'mimetype_python': '', 'filetype_py...la.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/code/scala/Applicative.scala'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'Unicode text, UTF-8 text', 'filetype_pygment': 'Scala', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/code/scala/Applicative.scala.yml', 'elf_type': '', 'filetype_file': 'UTF-8 Unicode text', ...}
@py_assert4 = False
@py_format9 = "{'contains_te... 'Scala', ...} == {'contains_te...de text', ...}\n~Omitting 38 identical items, use -vv to show\n~Dif...e:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/code/scala/Applicative.scala'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te... 'Scala', ...} == {'contains_te...de text', ...}\n~Omitting 38 identical items, use -vv to sho...e:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/code/scala/Applicative.scala'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te... 'Scala', ...} == {'contains_te...de text', ...}
E Omitting 38 identical items, use -vv to show
E Differing items:
E {'filetype_file': 'Unicode text, UTF-8 text'} != {'filetype_file': 'UTF-8 Unicode text'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/code/scala/Applicative.scala.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/code/scala/Applicative.scala'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
________ TestFileTypesDataDriven.test_filetest_compiled_win_file_exe_68 ________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6db20>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows, 5 sections', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows', 'mim.../file.exe.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/compiled/win/file.exe'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows, 5 sections', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/compiled/win/fi...lf_type': '', 'filetype_file': 'PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...Windows', ...}\n~Omitting 37 identical items, use -vv to show\n~Dif...30.0.1/tests/data/filetest/compiled/win/file.exe'}...\n~\n~...Full output truncated (1 line hidden), use '-vv' to show"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...Windows', ...}\n~Omitting 37 identical items, use -vv to sho...30.0.1/tests/data/filetest/compiled/win/file.exe'}...\n~\n~...Full output truncated (1 line hidden), use '-vv' to show"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...Windows', ...}
E Omitting 37 identical items, use -vv to show
E Differing items:
E {'mimetype_file': 'application/vnd.microsoft.portable-executable'} != {'mimetype_file': 'application/x-dosexec'}
E {'filetype_file': 'PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows, 5 sections'} != {'filetype_file': 'PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/compiled/win/file.exe.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/compiled/win/file.exe'}...
E
E ...Full output truncated (1 line hidden), use '-vv' to show
tests/filetype_test_utils.py:216: AssertionError
_______ TestFileTypesDataDriven.test_filetest_compiled_win_zlib1_dll_69 ________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6da00>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows, 8 sections', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows'...lib1.dll.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/compiled/win/zlib1.dll'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows, 8 sections', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/compiled/win/zl...e': '', 'filetype_file': 'PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...Windows', ...}\n~Omitting 37 identical items, use -vv to show\n~Dif...0.0.1/tests/data/filetest/compiled/win/zlib1.dll'}...\n~\n~...Full output truncated (1 line hidden), use '-vv' to show"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...Windows', ...}\n~Omitting 37 identical items, use -vv to sho...0.0.1/tests/data/filetest/compiled/win/zlib1.dll'}...\n~\n~...Full output truncated (1 line hidden), use '-vv' to show"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...Windows', ...}
E Omitting 37 identical items, use -vv to show
E Differing items:
E {'mimetype_file': 'application/vnd.microsoft.portable-executable'} != {'mimetype_file': 'application/x-dosexec'}
E {'filetype_file': 'PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows, 8 sections'} != {'filetype_file': 'PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/compiled/win/zlib1.dll.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/compiled/win/zlib1.dll'}...
E
E ...Full output truncated (1 line hidden), use '-vv' to show
tests/filetype_test_utils.py:216: AssertionError
___________ TestFileTypesDataDriven.test_filetest_data_mysql_arch_74 ___________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6e8a0>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'MySQL table definition file Version -32, type DIAM_ISAM, MySQL version -1515870811', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'MySQL table definition file Version 224, type DIAM_ISAM, MySQL version -1515870811', 'm...data/mysql-arch.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/mysql-arch'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'MySQL table definition file Version -32, type DIAM_ISAM, MySQL version -1515870811', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/mysql-arch..._type': '', 'filetype_file': 'MySQL table definition file Version 224, type DIAM_ISAM, MySQL version -1515870811', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...5870811', ...}\n~Omitting 38 identical items, use -vv to show\n~Dif...t_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/mysql-arch'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...5870811', ...}\n~Omitting 38 identical items, use -vv to sho...t_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/mysql-arch'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...5870811', ...}
E Omitting 38 identical items, use -vv to show
E Differing items:
E {'filetype_file': 'MySQL table definition file Version -32, type DIAM_ISAM, MySQL version -1515870811'} != {'filetype_file': 'MySQL table definition file Version 224, type DIAM_ISAM, MySQL version -1515870811'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/mysql-arch.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/mysql-arch'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
___________ TestFileTypesDataDriven.test_filetest_data_nulls_txt_78 ____________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6ec90>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'ASCII text, with very long lines (10000), with no line terminators', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'ASCII text, with very long lines, with no line terminators', 'mimetype_file': 'text/pla...t/data/nulls.txt.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/nulls.txt'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'ASCII text, with very long lines (10000), with no line terminators', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/nulls.txt.yml', 'elf_type': '', 'filetype_file': 'ASCII text, with very long lines, with no line terminators', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...inators', ...}\n~Omitting 38 identical items, use -vv to show\n~Dif...st_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/nulls.txt'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...inators', ...}\n~Omitting 38 identical items, use -vv to sho...st_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/nulls.txt'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...inators', ...}
E Omitting 38 identical items, use -vv to show
E Differing items:
E {'filetype_file': 'ASCII text, with very long lines (10000), with no line terminators'} != {'filetype_file': 'ASCII text, with very long lines, with no line terminators'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/nulls.txt.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/data/nulls.txt'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
_________ TestFileTypesDataDriven.test_filetest_doc_pdf_notpdf_pdf_94 __________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6cd40>,)
kwargs = {}
results = {'contains_text': True, 'elf_type': '', 'filetype_file': 'CSV ASCII text', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'CSV text', 'mimetype_file': 'application/csv', 'mimetype_python': 'application/pdf', 'f...f/notpdf.pdf.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/doc/pdf/notpdf.pdf'})
passing = False
@py_assert2 = {'contains_text': True, 'elf_type': '', 'filetype_file': 'CSV ASCII text', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': True, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/doc/pdf/notpdf.pdf.yml', 'elf_type': '', 'filetype_file': 'CSV text', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...SV text', ...}\n~Omitting 37 identical items, use -vv to show\n~Dif...ile': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/doc/pdf/notpdf.pdf'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...SV text', ...}\n~Omitting 37 identical items, use -vv to sho...ile': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/doc/pdf/notpdf.pdf'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...SV text', ...}
E Omitting 37 identical items, use -vv to show
E Differing items:
E {'mimetype_file': 'text/csv'} != {'mimetype_file': 'application/csv'}
E {'filetype_file': 'CSV ASCII text'} != {'filetype_file': 'CSV text'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/doc/pdf/notpdf.pdf.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/doc/pdf/notpdf.pdf'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
_______ TestFileTypesDataDriven.test_filetest_media_image_ascii_pgm_101 ________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6fa70>,)
kwargs = {}
results = {'contains_text': False, 'elf_type': '', 'filetype_file': 'Netpbm image data, size = 62 x 23, greymap, ASCII text', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'Netpbm image data, size = 62 x 23, greymap, ASCII text', 'mimetype_file': 'image/x-port...ascii.pgm.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image-ascii.pgm'})
passing = False
@py_assert2 = {'contains_text': False, 'elf_type': '', 'filetype_file': 'Netpbm image data, size = 62 x 23, greymap, ASCII text', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': False, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image-ascii.pgm.yml', 'elf_type': '', 'filetype_file': 'Netpbm image data, size = 62 x 23, greymap, ASCII text', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...II text', ...}\n~Omitting 38 identical items, use -vv to show\n~Dif...': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image-ascii.pgm'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...II text', ...}\n~Omitting 38 identical items, use -vv to sho...': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image-ascii.pgm'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...II text', ...}
E Omitting 38 identical items, use -vv to show
E Differing items:
E {'mimetype_file': 'image/x-portable-graymap'} != {'mimetype_file': 'image/x-portable-greymap'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image-ascii.pgm.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image-ascii.pgm'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
__________ TestFileTypesDataDriven.test_filetest_media_image1_pbm_112 __________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6fe30>,)
kwargs = {}
results = {'contains_text': False, 'elf_type': '', 'filetype_file': 'Netpbm image data, size = 1 x 1, bitmap Created by Paint Shop Pro 5, ASCII text', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'Netpbm image data, size = 1 x 1, bitmap, ASCII text', 'mimetype_file': 'image/x-portabl...dia/Image1.pbm.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.pbm'})
passing = False
@py_assert2 = {'contains_text': False, 'elf_type': '', 'filetype_file': 'Netpbm image data, size = 1 x 1, bitmap Created by Paint Shop Pro 5, ASCII text', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': False, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.pbm.yml', 'elf_type': '', 'filetype_file': 'Netpbm image data, size = 1 x 1, bitmap, ASCII text', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...II text', ...}\n~Omitting 38 identical items, use -vv to show\n~Dif..._file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.pbm'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...II text', ...}\n~Omitting 38 identical items, use -vv to sho..._file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.pbm'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E AssertionError: assert {'contains_te...ent': '', ...} == {'contains_te...II text', ...}
E Omitting 38 identical items, use -vv to show
E Differing items:
E {'filetype_file': 'Netpbm image data, size = 1 x 1, bitmap Created by Paint Shop Pro 5, ASCII text'} != {'filetype_file': 'Netpbm image data, size = 1 x 1, bitmap, ASCII text'}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.pbm.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.pbm'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
__________ TestFileTypesDataDriven.test_filetest_media_image1_tga_118 __________
args = (<test_types.TestFileTypesDataDriven object at 0x7f2558a6f1a0>,)
kwargs = {}
results = {'contains_text': False, 'elf_type': '', 'filetype_file': 'Targa image data - RGB - RLE 1 x 1 x 24 - author " " - comment " " 23-2-2010 10:24:54 - job " " - Paint Shop Pro 12.80', 'filetype_pygment': '', ...}
expected = OrderedDict({'filetype_file': 'data', 'mimetype_file': 'application/octet-stream', 'mimetype_python': '', 'filetype_py...dia/Image1.tga.yml', 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.tga'})
passing = False
@py_assert2 = {'contains_text': False, 'elf_type': '', 'filetype_file': 'Targa image data - RGB - RLE 1 x 1 x 24 - author " " - comment " " 23-2-2010 10:24:54 - job " " - Paint Shop Pro 12.80', 'filetype_pygment': '', ...}
@py_assert7 = {'contains_text': False, 'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.tga.yml', 'elf_type': '', 'filetype_file': 'data', ...}
@py_assert4 = False
@py_format9 = "{'contains_te...ent': '', ...} == {'contains_te...: 'data', ...}\n~Omitting 36 identical items, use -vv to show\n~Dif..._file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.tga'}\n~Use -v to get more diff"
@py_format11 = "assert {'contains_te...ent': '', ...} == {'contains_te...: 'data', ...}\n~Omitting 36 identical items, use -vv to sho..._file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.tga'}\n~Use -v to get more diff"
def closure_test_function(*args, **kwargs):
results = get_type(test_file).to_dict(include_date=False)
if regen:
for key, value in results.items():
setattr(test, key, value)
test.dump()
expected = test.to_dict(filter_empty=False, filter_extra=True)
passing = check_types_equal(expected, results)
# this is done to display slightly eaier to handle error traces
if not passing:
expected['data file'] = 'file://' + data_file
expected['test_file'] = 'file://' + test_file
> assert dict(results) == dict(expected)
E assert {'contains_te...ent': '', ...} == {'contains_te...: 'data', ...}
E Omitting 36 identical items, use -vv to show
E Differing items:
E {'mimetype_file': 'image/x-tga'} != {'mimetype_file': 'application/octet-stream'}
E {'filetype_file': 'Targa image data - RGB - RLE 1 x 1 x 24 - author " " - comment " " 23-2-2010 10:24:54 - job " " - Paint Shop Pro 12.80'} != {'filetype_file': 'data'}
E {'is_data': False} != {'is_data': True}
E Right contains 2 more items:
E {'data file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.tga.yml',
E 'test_file': 'file:///builddir/build/BUILD/typecode-30.0.1/tests/data/filetest/media/Image1.tga'}
E Use -v to get more diff
tests/filetype_test_utils.py:216: AssertionError
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
eclipseo commentedon Aug 23, 2023
pombredanne commentedon Aug 25, 2023
@eclipseo Thanks... all these failures are because of small or big changes and bug fixes in libmagic. There is no way around this than to fix theses to match old and new libmagic versions within reason and/or update the minimal version of libmagic we bundle and support too.
stefan6419846 commentedon Jan 23, 2026
I just did a recent run on the files, and it seems like there now "only" are 19 failures, although with some strange expected data which look like actual typos:
IS0 14496-12:2003instead ofISO 14496-12:2003PhotometricIntepretationinstead ofPhotometricInterpretationgreymapinstead ofgraymap(at least in the mime type)Other failures like
ECLIPSE.RSAbeing detected asDER Encoded PKCS#7 Signed Dataand thus not consideredis_datalooks wrong as well.Additionally, somethings looks wrong about the
data_fileandtest_filekeys of the data, which receives assertion errors as well.