Skip to content

numpy 2.x breaks the tests: ValueError: could not convert string to float: b'np.float32(0.0)' #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
carlosal1015 opened this issue Aug 14, 2024 · 5 comments

Comments

@carlosal1015
Copy link

Hi, when we run the tests from python-numpy-stl, some of them failed.

  -> Extracting numpy-stl-v3.1.2.tar.gz with bsdtar
==> Starting build()...
* Getting build dependencies for wheel...
warning: stl/_speedups.pyx:5:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
warning: stl/_speedups.pyx:12:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
warning: stl/_speedups.pyx:106:4: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
warning: stl/_speedups.pyx:170:8: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
Compiling stl/_speedups.pyx because it changed.
[1/1] Cythonizing stl/_speedups.pyx
running egg_info
creating numpy_stl.egg-info
writing numpy_stl.egg-info/PKG-INFO
writing dependency_links to numpy_stl.egg-info/dependency_links.txt
writing entry points to numpy_stl.egg-info/entry_points.txt
writing requirements to numpy_stl.egg-info/requires.txt
writing top-level names to numpy_stl.egg-info/top_level.txt
writing manifest file 'numpy_stl.egg-info/SOURCES.txt'
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative
reading manifest file 'numpy_stl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: manifest_maker: MANIFEST.in, line 1: unknown action 'include-recursive'

warning: no previously-included files matching '*.py[co]' found anywhere in distribution
no previously-included directories found matching 'docs/_build'
adding license file 'LICENSE'
writing manifest file 'numpy_stl.egg-info/SOURCES.txt'
* Building wheel...
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-312
creating build/lib.linux-x86_64-cpython-312/stl
copying stl/mesh.py -> build/lib.linux-x86_64-cpython-312/stl
copying stl/base.py -> build/lib.linux-x86_64-cpython-312/stl
copying stl/main.py -> build/lib.linux-x86_64-cpython-312/stl
copying stl/stl.py -> build/lib.linux-x86_64-cpython-312/stl
copying stl/utils.py -> build/lib.linux-x86_64-cpython-312/stl
copying stl/__about__.py -> build/lib.linux-x86_64-cpython-312/stl
copying stl/__init__.py -> build/lib.linux-x86_64-cpython-312/stl
copying stl/py.typed -> build/lib.linux-x86_64-cpython-312/stl
running build_ext
building 'stl._speedups' extension
creating build/temp.linux-x86_64-cpython-312
creating build/temp.linux-x86_64-cpython-312/stl
gcc -fno-strict-overflow -DNDEBUG -g -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -ffat-lto-objects -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/python-numpy-stl/src=/usr/src/debug/python-numpy-stl -flto=auto -fPIC -I/usr/lib/python3.12/site-packages/numpy/_core/include -I/usr/include/python3.12 -c stl/_speedups.c -o build/temp.linux-x86_64-cpython-312/stl/_speedups.o
In file included from /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarraytypes.h:1909,
                 from /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarrayobject.h:12,
                 from /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/arrayobject.h:5,
                 from stl/_speedups.c:1251:
/usr/lib/python3.12/site-packages/numpy/_core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   17 | #warning "Using deprecated NumPy API, disable it with " \
      |  ^~~~~~~
In function ‘__pyx_pf_3stl_9_speedups_2ascii_write’,
    inlined from ‘__pyx_pw_3stl_9_speedups_3ascii_write’ at stl/_speedups.c:6858:13:
stl/_speedups.c:7158:23: warning: ‘__pyx_v_fp’ may be used uninitialized [-Wmaybe-uninitialized]
 7158 |         __pyx_v_pos = ftell(__pyx_v_fp);
      |                       ^~~~~~~~~~~~~~~~~
stl/_speedups.c: In function ‘__pyx_pw_3stl_9_speedups_3ascii_write’:
stl/_speedups.c:6876:9: note: ‘__pyx_v_fp’ was declared here
 6876 |   FILE *__pyx_v_fp;
      |         ^~~~~~~~~~
gcc -shared -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/python-numpy-stl/src=/usr/src/debug/python-numpy-stl -flto=auto build/temp.linux-x86_64-cpython-312/stl/_speedups.o -L/usr/lib -o build/lib.linux-x86_64-cpython-312/stl/_speedups.cpython-312-x86_64-linux-gnu.so
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/stl
copying build/lib.linux-x86_64-cpython-312/stl/mesh.py -> build/bdist.linux-x86_64/wheel/stl
copying build/lib.linux-x86_64-cpython-312/stl/base.py -> build/bdist.linux-x86_64/wheel/stl
copying build/lib.linux-x86_64-cpython-312/stl/main.py -> build/bdist.linux-x86_64/wheel/stl
copying build/lib.linux-x86_64-cpython-312/stl/stl.py -> build/bdist.linux-x86_64/wheel/stl
copying build/lib.linux-x86_64-cpython-312/stl/utils.py -> build/bdist.linux-x86_64/wheel/stl
copying build/lib.linux-x86_64-cpython-312/stl/__about__.py -> build/bdist.linux-x86_64/wheel/stl
copying build/lib.linux-x86_64-cpython-312/stl/_speedups.cpython-312-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/wheel/stl
copying build/lib.linux-x86_64-cpython-312/stl/__init__.py -> build/bdist.linux-x86_64/wheel/stl
copying build/lib.linux-x86_64-cpython-312/stl/py.typed -> build/bdist.linux-x86_64/wheel/stl
running install_egg_info
running egg_info
writing numpy_stl.egg-info/PKG-INFO
writing dependency_links to numpy_stl.egg-info/dependency_links.txt
writing entry points to numpy_stl.egg-info/entry_points.txt
writing requirements to numpy_stl.egg-info/requires.txt
writing top-level names to numpy_stl.egg-info/top_level.txt
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative
dependency /usr/lib/python3.12/site-packages/numpy/_core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative
reading manifest file 'numpy_stl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: manifest_maker: MANIFEST.in, line 1: unknown action 'include-recursive'

warning: no previously-included files matching '*.py[co]' found anywhere in distribution
no previously-included directories found matching 'docs/_build'
adding license file 'LICENSE'
writing manifest file 'numpy_stl.egg-info/SOURCES.txt'
Copying numpy_stl.egg-info to build/bdist.linux-x86_64/wheel/numpy_stl-3.1.2-py3.12.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/numpy_stl-3.1.2.dist-info/WHEEL
creating '/build/python-numpy-stl/src/numpy-stl-3.1.2/dist/.tmp-zme8flx5/numpy_stl-3.1.2-cp312-cp312-linux_x86_64.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'stl/__about__.py'
adding 'stl/__init__.py'
adding 'stl/_speedups.cpython-312-x86_64-linux-gnu.so'
adding 'stl/base.py'
adding 'stl/main.py'
adding 'stl/mesh.py'
adding 'stl/py.typed'
adding 'stl/stl.py'
adding 'stl/utils.py'
adding 'numpy_stl-3.1.2.dist-info/LICENSE'
adding 'numpy_stl-3.1.2.dist-info/METADATA'
adding 'numpy_stl-3.1.2.dist-info/WHEEL'
adding 'numpy_stl-3.1.2.dist-info/entry_points.txt'
adding 'numpy_stl-3.1.2.dist-info/top_level.txt'
adding 'numpy_stl-3.1.2.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built numpy_stl-3.1.2-cp312-cp312-linux_x86_64.whl
==> Starting check()...
============================= test session starts ==============================
platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /build/python-numpy-stl/src/numpy-stl-3.1.2
configfile: pytest.ini
plugins: cov-5.0.0
collecting ... collected 126 items

tests/stl_corruption.py::test_valid_ascii[False] PASSED                  [  0%]
tests/stl_corruption.py::test_valid_ascii[True] PASSED                   [  1%]
tests/stl_corruption.py::test_end_solid[False] PASSED                    [  2%]
tests/stl_corruption.py::test_end_solid[True] PASSED                     [  3%]
tests/stl_corruption.py::test_ascii_with_missing_name[False] PASSED      [  3%]
tests/stl_corruption.py::test_ascii_with_missing_name[True] PASSED       [  4%]
tests/stl_corruption.py::test_ascii_with_blank_lines[False] PASSED       [  5%]
tests/stl_corruption.py::test_ascii_with_blank_lines[True] PASSED        [  6%]
tests/stl_corruption.py::test_incomplete_ascii_file[False] PASSED        [  7%]
tests/stl_corruption.py::test_incomplete_ascii_file[True] PASSED         [  7%]
tests/stl_corruption.py::test_corrupt_ascii_file[False] PASSED           [  8%]
tests/stl_corruption.py::test_corrupt_ascii_file[True] PASSED            [  9%]
tests/stl_corruption.py::test_corrupt_binary_file[False] PASSED          [ 10%]
tests/stl_corruption.py::test_corrupt_binary_file[True] PASSED           [ 11%]
tests/stl_corruption.py::test_duplicate_polygons[False] PASSED           [ 11%]
tests/stl_corruption.py::test_duplicate_polygons[True] PASSED            [ 12%]
tests/test_ascii.py::test_ascii_file[False] PASSED                       [ 13%]
tests/test_ascii.py::test_ascii_file[True] PASSED                        [ 14%]
tests/test_ascii.py::test_chinese_name[False] PASSED                     [ 15%]
tests/test_ascii.py::test_chinese_name[True] PASSED                      [ 15%]
tests/test_ascii.py::test_long_name[False] PASSED                        [ 16%]
tests/test_ascii.py::test_long_name[True] PASSED                         [ 17%]
tests/test_ascii.py::test_scientific_notation[False] PASSED              [ 18%]
tests/test_ascii.py::test_scientific_notation[True] PASSED               [ 19%]
tests/test_ascii.py::test_locale_restore[False] SKIPPED (Only makes
sense with speedups)                                                     [ 19%]
tests/test_ascii.py::test_locale_restore[True] PASSED                    [ 20%]
tests/test_ascii.py::test_use_with_qt_with_custom_locale_decimal_delimeter[False] SKIPPED [ 21%]
tests/test_ascii.py::test_use_with_qt_with_custom_locale_decimal_delimeter[True] SKIPPED [ 22%]
tests/test_ascii.py::test_ascii_io[False] FAILED                         [ 23%]
tests/test_ascii.py::test_ascii_io[True] FAILED                          [ 23%]
tests/test_binary.py::test_ascii_like_binary[False-2] PASSED             [ 24%]
tests/test_binary.py::test_ascii_like_binary[False-0] PASSED             [ 25%]
tests/test_binary.py::test_ascii_like_binary[True-2] PASSED              [ 26%]
tests/test_binary.py::test_ascii_like_binary[True-0] PASSED              [ 26%]
tests/test_binary.py::test_binary_in_ascii_mode[False] PASSED            [ 27%]
tests/test_binary.py::test_binary_in_ascii_mode[True] PASSED             [ 28%]
tests/test_binary.py::test_write_bytes_io[False-2] PASSED                [ 29%]
tests/test_binary.py::test_write_bytes_io[False-0] PASSED                [ 30%]
tests/test_binary.py::test_write_bytes_io[True-2] PASSED                 [ 30%]
tests/test_binary.py::test_write_bytes_io[True-0] PASSED                 [ 31%]
tests/test_binary.py::test_binary_file[False] PASSED                     [ 32%]
tests/test_binary.py::test_binary_file[True] PASSED                      [ 33%]
tests/test_commandline.py::test_main[False] PASSED                       [ 34%]
tests/test_commandline.py::test_main[True] PASSED                        [ 34%]
tests/test_commandline.py::test_args[False] PASSED                       [ 35%]
tests/test_commandline.py::test_args[True] PASSED                        [ 36%]
tests/test_commandline.py::test_ascii[False] PASSED                      [ 37%]
tests/test_commandline.py::test_ascii[True] PASSED                       [ 38%]
tests/test_commandline.py::test_binary[False] PASSED                     [ 38%]
tests/test_commandline.py::test_binary[True] PASSED                      [ 39%]
tests/test_convert.py::test_ascii_to_binary[False] PASSED                [ 40%]
tests/test_convert.py::test_ascii_to_binary[True] PASSED                 [ 41%]
tests/test_convert.py::test_binary_to_ascii[False] PASSED                [ 42%]
tests/test_convert.py::test_binary_to_ascii[True] PASSED                 [ 42%]
tests/test_convert.py::test_stl_mesh[False] PASSED                       [ 43%]
tests/test_convert.py::test_stl_mesh[True] PASSED                        [ 44%]
tests/test_line_endings.py::test_line_endings[False-dos] PASSED          [ 45%]
tests/test_line_endings.py::test_line_endings[False-unix] PASSED         [ 46%]
tests/test_line_endings.py::test_line_endings[True-dos] PASSED           [ 46%]
tests/test_line_endings.py::test_line_endings[True-unix] PASSED          [ 47%]
tests/test_mesh.py::test_units_1d[False] PASSED                          [ 48%]
tests/test_mesh.py::test_units_1d[True] PASSED                           [ 49%]
tests/test_mesh.py::test_units_2d[False] PASSED                          [ 50%]
tests/test_mesh.py::test_units_2d[True] PASSED                           [ 50%]
tests/test_mesh.py::test_units_3d[False] PASSED                          [ 51%]
tests/test_mesh.py::test_units_3d[True] PASSED                           [ 52%]
tests/test_mesh.py::test_duplicate_polygons[False] PASSED                [ 53%]
tests/test_mesh.py::test_duplicate_polygons[True] PASSED                 [ 53%]
tests/test_mesh.py::test_remove_all_duplicate_polygons[False] PASSED     [ 54%]
tests/test_mesh.py::test_remove_all_duplicate_polygons[True] PASSED      [ 55%]
tests/test_mesh.py::test_empty_areas[False] PASSED                       [ 56%]
tests/test_mesh.py::test_empty_areas[True] PASSED                        [ 57%]
tests/test_mesh.py::test_base_mesh[False] PASSED                         [ 57%]
tests/test_mesh.py::test_base_mesh[True] PASSED                          [ 58%]
tests/test_meshProperties.py::test_mass_properties_for_half_donut[ascii-False] FAILED [ 59%]
tests/test_meshProperties.py::test_mass_properties_for_half_donut[ascii-True] FAILED [ 60%]
tests/test_meshProperties.py::test_mass_properties_for_moon[ascii-False] PASSED [ 61%]
tests/test_meshProperties.py::test_mass_properties_for_moon[ascii-True] PASSED [ 61%]
tests/test_meshProperties.py::test_mass_properties_for_star[ascii-False-Star.stl] PASSED [ 62%]
tests/test_meshProperties.py::test_mass_properties_for_star[ascii-False-StarWithEmptyHeader.stl] SKIPPED [ 63%]
tests/test_meshProperties.py::test_mass_properties_for_star[ascii-True-Star.stl] PASSED [ 64%]
tests/test_meshProperties.py::test_mass_properties_for_star[ascii-True-StarWithEmptyHeader.stl] SKIPPED [ 65%]
tests/test_meshProperties.py::test_mass_properties_for_half_donut_with_density[ascii-False] FAILED [ 65%]
tests/test_meshProperties.py::test_mass_properties_for_half_donut_with_density[ascii-True] FAILED [ 66%]
tests/test_meshProperties.py::test_mass_properties_for_half_donut[binary-False] FAILED [ 67%]
tests/test_meshProperties.py::test_mass_properties_for_half_donut[binary-True] FAILED [ 68%]
tests/test_meshProperties.py::test_mass_properties_for_moon[binary-False] PASSED [ 69%]
tests/test_meshProperties.py::test_mass_properties_for_moon[binary-True] PASSED [ 69%]
tests/test_meshProperties.py::test_mass_properties_for_star[binary-False-Star.stl] PASSED [ 70%]
tests/test_meshProperties.py::test_mass_properties_for_star[binary-False-StarWithEmptyHeader.stl] PASSED [ 71%]
tests/test_meshProperties.py::test_mass_properties_for_star[binary-True-Star.stl] PASSED [ 72%]
tests/test_meshProperties.py::test_mass_properties_for_star[binary-True-StarWithEmptyHeader.stl] PASSED [ 73%]
tests/test_meshProperties.py::test_mass_properties_for_half_donut_with_density[binary-False] FAILED [ 73%]
tests/test_meshProperties.py::test_mass_properties_for_half_donut_with_density[binary-True] FAILED [ 74%]
tests/test_multiple.py::test_single_stl[False] PASSED                    [ 75%]
tests/test_multiple.py::test_single_stl[True] PASSED                     [ 76%]
tests/test_multiple.py::test_multiple_stl[False] PASSED                  [ 76%]
tests/test_multiple.py::test_multiple_stl[True] PASSED                   [ 77%]
tests/test_multiple.py::test_single_stl_file[False] PASSED               [ 78%]
tests/test_multiple.py::test_single_stl_file[True] PASSED                [ 79%]
tests/test_multiple.py::test_multiple_stl_file[False] PASSED             [ 80%]
tests/test_multiple.py::test_multiple_stl_file[True] PASSED              [ 80%]
tests/test_multiple.py::test_multiple_stl_files[False] PASSED            [ 81%]
tests/test_multiple.py::test_multiple_stl_files[True] PASSED             [ 82%]
tests/test_multiple.py::test_3mf_file[False] PASSED                      [ 83%]
tests/test_multiple.py::test_3mf_file[True] PASSED                       [ 84%]
tests/test_multiple.py::test_3mf_missing_file[False] PASSED              [ 84%]
tests/test_multiple.py::test_3mf_missing_file[True] PASSED               [ 85%]
tests/test_multiple.py::test_3mf_wrong_file[False] PASSED                [ 86%]
tests/test_multiple.py::test_3mf_wrong_file[True] PASSED                 [ 87%]
tests/test_rotate.py::test_rotation[False] PASSED                        [ 88%]
tests/test_rotate.py::test_rotation[True] PASSED                         [ 88%]
tests/test_rotate.py::test_rotation_over_point[False] PASSED             [ 89%]
tests/test_rotate.py::test_rotation_over_point[True] PASSED              [ 90%]
tests/test_rotate.py::test_double_rotation[False] PASSED                 [ 91%]
tests/test_rotate.py::test_double_rotation[True] PASSED                  [ 92%]
tests/test_rotate.py::test_no_rotation[False] PASSED                     [ 92%]
tests/test_rotate.py::test_no_rotation[True] PASSED                      [ 93%]
tests/test_rotate.py::test_no_translation[False] PASSED                  [ 94%]
tests/test_rotate.py::test_no_translation[True] PASSED                   [ 95%]
tests/test_rotate.py::test_translation[False] PASSED                     [ 96%]
tests/test_rotate.py::test_translation[True] PASSED                      [ 96%]
tests/test_rotate.py::test_no_transformation[False] PASSED               [ 97%]
tests/test_rotate.py::test_no_transformation[True] PASSED                [ 98%]
tests/test_rotate.py::test_transformation[False] PASSED                  [ 99%]
tests/test_rotate.py::test_transformation[True] PASSED                   [100%]

=================================== FAILURES ===================================
_____________________________ test_ascii_io[False] _____________________________

    def test_ascii_io():
        # Create a vanilla mesh.
        mesh_ = mesh.Mesh(numpy.empty(3, mesh.Mesh.dtype))
        mesh_.vectors = numpy.arange(27).reshape((3, 3, 3))
    
        # Check that unhelpful 'expected str but got bytes' error is caught and
        # replaced.
        with pytest.raises(TypeError, match="handles should be in binary mode"):
            mesh_.save("nameless", fh=io.StringIO(), mode=Mode.ASCII)
    
        # Write to an io.BytesIO().
        fh = io.BytesIO()
        mesh_.save("nameless", fh=fh, mode=Mode.ASCII)
        # Assert binary file is still only ascii characters.
        fh.getvalue().decode("ascii")
    
        # Read the mesh back in.
>       read = mesh.Mesh.from_file("anonymous.stl", fh=io.BytesIO(fh.getvalue()))

tests/test_ascii.py:183: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
stl/stl.py:385: in from_file
    name, data = cls.load(
stl/stl.py:68: in load
    name, data = cls._load_ascii(
stl/stl.py:246: in _load_ascii
    return name, numpy.fromiter(iterator, dtype=cls.dtype)
stl/stl.py:218: in _ascii_reader
    normals = get('facet normal')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prefix = b'facet normal'

    def get(prefix=''):
        prefix = b(prefix).lower()
    
        if lines:
            raw_line = lines.pop(0)
        else:
            raise RuntimeError(recoverable[0], 'Unable to find more lines')
    
        if not lines:
            recoverable[0] = False
    
            # Read more lines and make sure we prepend any old data
            lines[:] = b(fh.read(BUFFER_SIZE)).split(b'\n')
            raw_line += lines.pop(0)
    
        raw_line = raw_line.strip()
        line = raw_line.lower()
        if line == b(''):
            return get(prefix)
    
        if prefix:
            if line.startswith(prefix):
                values = line.replace(prefix, b(''), 1).strip().split()
            elif line.startswith(b('endsolid')) \
                or line.startswith(b('end solid')):
                # go back to the beginning of new solid part
                size_unprocessedlines = sum(
                    len(line) + 1 for line in lines
                ) - 1
    
                if size_unprocessedlines > 0:
                    position = fh.tell()
                    fh.seek(position - size_unprocessedlines)
                raise StopIteration()
            else:
                raise RuntimeError(
                    recoverable[0],
                    '%r should start with %r' % (line, prefix)
                )
    
            if len(values) == 3:
>               return [float(v) for v in values]
E               ValueError: could not convert string to float: b'np.float32(0.0)'

stl/stl.py:191: ValueError
_____________________________ test_ascii_io[True] ______________________________

    def test_ascii_io():
        # Create a vanilla mesh.
        mesh_ = mesh.Mesh(numpy.empty(3, mesh.Mesh.dtype))
        mesh_.vectors = numpy.arange(27).reshape((3, 3, 3))
    
        # Check that unhelpful 'expected str but got bytes' error is caught and
        # replaced.
        with pytest.raises(TypeError, match="handles should be in binary mode"):
            mesh_.save("nameless", fh=io.StringIO(), mode=Mode.ASCII)
    
        # Write to an io.BytesIO().
        fh = io.BytesIO()
        mesh_.save("nameless", fh=fh, mode=Mode.ASCII)
        # Assert binary file is still only ascii characters.
        fh.getvalue().decode("ascii")
    
        # Read the mesh back in.
>       read = mesh.Mesh.from_file("anonymous.stl", fh=io.BytesIO(fh.getvalue()))

tests/test_ascii.py:183: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
stl/stl.py:385: in from_file
    name, data = cls.load(
stl/stl.py:68: in load
    name, data = cls._load_ascii(
stl/stl.py:246: in _load_ascii
    return name, numpy.fromiter(iterator, dtype=cls.dtype)
stl/stl.py:218: in _ascii_reader
    normals = get('facet normal')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prefix = b'facet normal'

    def get(prefix=''):
        prefix = b(prefix).lower()
    
        if lines:
            raw_line = lines.pop(0)
        else:
            raise RuntimeError(recoverable[0], 'Unable to find more lines')
    
        if not lines:
            recoverable[0] = False
    
            # Read more lines and make sure we prepend any old data
            lines[:] = b(fh.read(BUFFER_SIZE)).split(b'\n')
            raw_line += lines.pop(0)
    
        raw_line = raw_line.strip()
        line = raw_line.lower()
        if line == b(''):
            return get(prefix)
    
        if prefix:
            if line.startswith(prefix):
                values = line.replace(prefix, b(''), 1).strip().split()
            elif line.startswith(b('endsolid')) \
                or line.startswith(b('end solid')):
                # go back to the beginning of new solid part
                size_unprocessedlines = sum(
                    len(line) + 1 for line in lines
                ) - 1
    
                if size_unprocessedlines > 0:
                    position = fh.tell()
                    fh.seek(position - size_unprocessedlines)
                raise StopIteration()
            else:
                raise RuntimeError(
                    recoverable[0],
                    '%r should start with %r' % (line, prefix)
                )
    
            if len(values) == 3:
>               return [float(v) for v in values]
E               ValueError: could not convert string to float: b'np.float32(0.0)'

stl/stl.py:191: ValueError
_______________ test_mass_properties_for_half_donut[ascii-False] _______________

binary_ascii_path = PosixPath('/build/python-numpy-stl/src/numpy-stl-3.1.2/tests/stl_ascii')
speedups = False

    def test_mass_properties_for_half_donut(binary_ascii_path, speedups):
        '''
        Checks the results of method get_mass_properties() on
        STL ASCII and binary files HalfDonut.stl
        One checks the results obtained with stl
        with the ones obtained with meshlab
        '''
        filename = binary_ascii_path/'HalfDonut.stl'
        mesh = stl.StlMesh(str(filename), speedups=speedups)
        volume, cog, inertia = mesh.get_mass_properties()
        assert close([volume], [2.343149])
        assert close(cog, [1.500001, 0.209472, 1.500001])
>       assert close(inertia, [[+1.390429, +0.000000, +0.000000],
                               [+0.000000, +2.701025, +0.000000],
                               [+0.000000, +0.000000, +1.390429]])
E       assert False
E        +  where False = close(array([[1.39042477e+00, 7.83056320e-07, 1.65303997e-06],\n       [7.83056320e-07, 2.70102564e+00, 1.62463063e-06],\n       [1.65303997e-06, 1.62463063e-06, 1.39043310e+00]]), [[1.390429, 0.0, 0.0], [0.0, 2.701025, 0.0], [0.0, 0.0, 1.390429]])

tests/test_meshProperties.py:26: AssertionError
_______________ test_mass_properties_for_half_donut[ascii-True] ________________

binary_ascii_path = PosixPath('/build/python-numpy-stl/src/numpy-stl-3.1.2/tests/stl_ascii')
speedups = True

    def test_mass_properties_for_half_donut(binary_ascii_path, speedups):
        '''
        Checks the results of method get_mass_properties() on
        STL ASCII and binary files HalfDonut.stl
        One checks the results obtained with stl
        with the ones obtained with meshlab
        '''
        filename = binary_ascii_path/'HalfDonut.stl'
        mesh = stl.StlMesh(str(filename), speedups=speedups)
        volume, cog, inertia = mesh.get_mass_properties()
        assert close([volume], [2.343149])
        assert close(cog, [1.500001, 0.209472, 1.500001])
>       assert close(inertia, [[+1.390429, +0.000000, +0.000000],
                               [+0.000000, +2.701025, +0.000000],
                               [+0.000000, +0.000000, +1.390429]])
E       assert False
E        +  where False = close(array([[1.39042477e+00, 7.83056320e-07, 1.65303997e-06],\n       [7.83056320e-07, 2.70102564e+00, 1.62463063e-06],\n       [1.65303997e-06, 1.62463063e-06, 1.39043310e+00]]), [[1.390429, 0.0, 0.0], [0.0, 2.701025, 0.0], [0.0, 0.0, 1.390429]])

tests/test_meshProperties.py:26: AssertionError
________ test_mass_properties_for_half_donut_with_density[ascii-False] _________

binary_ascii_path = PosixPath('/build/python-numpy-stl/src/numpy-stl-3.1.2/tests/stl_ascii')
speedups = False

    def test_mass_properties_for_half_donut_with_density(
            binary_ascii_path, speedups):
        '''
        Checks the results of method get_mass_properties_with_density() on
        STL ASCII and binary files HalfDonut.stl
        One checks the results obtained with stl
        with the ones obtained with meshlab
        '''
        filename = binary_ascii_path/'HalfDonut.stl'
        mesh = stl.StlMesh(str(filename), speedups=speedups)
        volume, mass, cog, inertia = mesh.get_mass_properties_with_density(1.23)
    
        assert close([mass], [2.882083302268982])
        assert close([volume], [2.343149026234945])
        assert close(cog, [1.500001, 0.209472, 1.500001])
        print('inertia')
        numpy.set_printoptions(suppress=True)
        print(inertia)
>       assert close(inertia, [[+1.71022851, +0.00000001, -0.00000011],
                               [+0.00000001, +3.32226227, +0.00000002],
                               [-0.00000011, +0.00000002, +1.71022859]])
E       assert False
E        +  where False = close(array([[1.71022246, 0.00000096, 0.00000203],\n       [0.00000096, 3.32226154, 0.000002  ],\n       [0.00000203, 0.000002  , 1.71023271]]), [[1.71022851, 1e-08, -1.1e-07], [1e-08, 3.32226227, 2e-08], [-1.1e-07, 2e-08, 1.71022859]])

tests/test_meshProperties.py:87: AssertionError
----------------------------- Captured stdout call -----------------------------
inertia
[[1.71022246 0.00000096 0.00000203]
 [0.00000096 3.32226154 0.000002  ]
 [0.00000203 0.000002   1.71023271]]
------------------------------ Captured log call -------------------------------
WARNING  stl.base.BaseMesh:logger.py:109 Use of not exact is_closed check. This check can lead to misleading
            results. You could try to use `exact=True`.
            See:
             - false positive: https://github.com/wolph/numpy-stl/issues/198
             - false negative: https://github.com/wolph/numpy-stl/pull/213
_________ test_mass_properties_for_half_donut_with_density[ascii-True] _________

binary_ascii_path = PosixPath('/build/python-numpy-stl/src/numpy-stl-3.1.2/tests/stl_ascii')
speedups = True

    def test_mass_properties_for_half_donut_with_density(
            binary_ascii_path, speedups):
        '''
        Checks the results of method get_mass_properties_with_density() on
        STL ASCII and binary files HalfDonut.stl
        One checks the results obtained with stl
        with the ones obtained with meshlab
        '''
        filename = binary_ascii_path/'HalfDonut.stl'
        mesh = stl.StlMesh(str(filename), speedups=speedups)
        volume, mass, cog, inertia = mesh.get_mass_properties_with_density(1.23)
    
        assert close([mass], [2.882083302268982])
        assert close([volume], [2.343149026234945])
        assert close(cog, [1.500001, 0.209472, 1.500001])
        print('inertia')
        numpy.set_printoptions(suppress=True)
        print(inertia)
>       assert close(inertia, [[+1.71022851, +0.00000001, -0.00000011],
                               [+0.00000001, +3.32226227, +0.00000002],
                               [-0.00000011, +0.00000002, +1.71022859]])
E       assert False
E        +  where False = close(array([[1.71022246, 0.00000096, 0.00000203],\n       [0.00000096, 3.32226154, 0.000002  ],\n       [0.00000203, 0.000002  , 1.71023271]]), [[1.71022851, 1e-08, -1.1e-07], [1e-08, 3.32226227, 2e-08], [-1.1e-07, 2e-08, 1.71022859]])

tests/test_meshProperties.py:87: AssertionError
----------------------------- Captured stdout call -----------------------------
inertia
[[1.71022246 0.00000096 0.00000203]
 [0.00000096 3.32226154 0.000002  ]
 [0.00000203 0.000002   1.71023271]]
------------------------------ Captured log call -------------------------------
WARNING  stl.base.BaseMesh:logger.py:109 Use of not exact is_closed check. This check can lead to misleading
            results. You could try to use `exact=True`.
            See:
             - false positive: https://github.com/wolph/numpy-stl/issues/198
             - false negative: https://github.com/wolph/numpy-stl/pull/213
______________ test_mass_properties_for_half_donut[binary-False] _______________

binary_ascii_path = PosixPath('/build/python-numpy-stl/src/numpy-stl-3.1.2/tests/stl_binary')
speedups = False

    def test_mass_properties_for_half_donut(binary_ascii_path, speedups):
        '''
        Checks the results of method get_mass_properties() on
        STL ASCII and binary files HalfDonut.stl
        One checks the results obtained with stl
        with the ones obtained with meshlab
        '''
        filename = binary_ascii_path/'HalfDonut.stl'
        mesh = stl.StlMesh(str(filename), speedups=speedups)
        volume, cog, inertia = mesh.get_mass_properties()
        assert close([volume], [2.343149])
        assert close(cog, [1.500001, 0.209472, 1.500001])
>       assert close(inertia, [[+1.390429, +0.000000, +0.000000],
                               [+0.000000, +2.701025, +0.000000],
                               [+0.000000, +0.000000, +1.390429]])
E       assert False
E        +  where False = close(array([[1.39042477, 0.00000078, 0.00000165],\n       [0.00000078, 2.70102564, 0.00000162],\n       [0.00000165, 0.00000162, 1.3904331 ]]), [[1.390429, 0.0, 0.0], [0.0, 2.701025, 0.0], [0.0, 0.0, 1.390429]])

tests/test_meshProperties.py:26: AssertionError
----------------------------- Captured stdout call -----------------------------
exception (False, "b'!\\xbc\\xafw\\x7f>\\xe6\\x04\\xb5>\\x88e{?l\\x08\\x9e>f\\x83\\xec>\\x00\\x00\\xc0?\\xd1v\\xcc>f\\x83\\xec>\\xbe\\xa4\\x85?\\x00\\x00\\xb1\\xf5e\\xbd\\xed\\x13\\xac=\\x9f\\xf76\\xbc\\xafw\\x7f>\\xe6\\x04\\xb5>\\x88e{?4\\xf6\\x15>\\xe6\\x04\\xb5>\\x00\\x00\\xc0?l\\x08\\x9e>f\\x83\\xec>\\x00\\x00\\xc0?\\x00\\x00\\xfamj\\xbc[\\xf6\\x95=\\x9c,\\x07\\xbc\\x15x(?f\\x83\\xec>\\x15x(?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\x00\\x00c\\x02q\\xbc0\\xa8\\xb2=\\xcf\\t!\\xbc\\x15x(?f\\x83\\xec>\\x15x(?\\xd1v\\xcc>f\\x83\\xec>\\xbe\\xa4\\x85?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\x00\\x00\\xfa\\x97#<\\xfa\\x88r=\\x85\\x9e\\xda;\\xfe\\x9dm?f\\x83\\xec>\\xfe\\x9dm?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\x00\\x00\\xfamj<\\x1f\\xf6\\x95=\\x9c,\\x07<\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\x00\\x00y8\\xba<\\x8c_$=\\xc0\\xd7x<k}\\x85?\\xe6\\x04\\xb5>k}\\x85?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?x\\x1bg?\\xe6\\x04\\xb5>\\xdau\\xa0?\\x00\\x00\\xbc\\xf0\\xe8<\\x19\\x9bm=b\\xa5\\x9b<k}\\x85?\\xe6\\x04\\xb5>k}\\x85?\\xfe\\x9dm?f\\x83\\xec>\\xfe\\x9dm?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\x00\\x00' should start with b'facet normal'")
_______________ test_mass_properties_for_half_donut[binary-True] _______________

binary_ascii_path = PosixPath('/build/python-numpy-stl/src/numpy-stl-3.1.2/tests/stl_binary')
speedups = True

    def test_mass_properties_for_half_donut(binary_ascii_path, speedups):
        '''
        Checks the results of method get_mass_properties() on
        STL ASCII and binary files HalfDonut.stl
        One checks the results obtained with stl
        with the ones obtained with meshlab
        '''
        filename = binary_ascii_path/'HalfDonut.stl'
        mesh = stl.StlMesh(str(filename), speedups=speedups)
        volume, cog, inertia = mesh.get_mass_properties()
        assert close([volume], [2.343149])
        assert close(cog, [1.500001, 0.209472, 1.500001])
>       assert close(inertia, [[+1.390429, +0.000000, +0.000000],
                               [+0.000000, +2.701025, +0.000000],
                               [+0.000000, +0.000000, +1.390429]])
E       assert False
E        +  where False = close(array([[1.39042477, 0.00000078, 0.00000165],\n       [0.00000078, 2.70102564, 0.00000162],\n       [0.00000165, 0.00000162, 1.3904331 ]]), [[1.390429, 0.0, 0.0], [0.0, 2.701025, 0.0], [0.0, 0.0, 1.390429]])

tests/test_meshProperties.py:26: AssertionError
----------------------------- Captured stdout call -----------------------------
exception (False, "b'!\\xbc\\xafw\\x7f>\\xe6\\x04\\xb5>\\x88e{?l\\x08\\x9e>f\\x83\\xec>\\x00\\x00\\xc0?\\xd1v\\xcc>f\\x83\\xec>\\xbe\\xa4\\x85?\\x00\\x00\\xb1\\xf5e\\xbd\\xed\\x13\\xac=\\x9f\\xf76\\xbc\\xafw\\x7f>\\xe6\\x04\\xb5>\\x88e{?4\\xf6\\x15>\\xe6\\x04\\xb5>\\x00\\x00\\xc0?l\\x08\\x9e>f\\x83\\xec>\\x00\\x00\\xc0?\\x00\\x00\\xfamj\\xbc[\\xf6\\x95=\\x9c,\\x07\\xbc\\x15x(?f\\x83\\xec>\\x15x(?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\x00\\x00c\\x02q\\xbc0\\xa8\\xb2=\\xcf\\t!\\xbc\\x15x(?f\\x83\\xec>\\x15x(?\\xd1v\\xcc>f\\x83\\xec>\\xbe\\xa4\\x85?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\x00\\x00\\xfa\\x97#<\\xfa\\x88r=\\x85\\x9e\\xda;\\xfe\\x9dm?f\\x83\\xec>\\xfe\\x9dm?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\x00\\x00\\xfamj<\\x1f\\xf6\\x95=\\x9c,\\x07<\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\x00\\x00y8\\xba<\\x8c_$=\\xc0\\xd7x<k}\\x85?\\xe6\\x04\\xb5>k}\\x85?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?x\\x1bg?\\xe6\\x04\\xb5>\\xdau\\xa0?\\x00\\x00\\xbc\\xf0\\xe8<\\x19\\x9bm=b\\xa5\\x9b<k}\\x85?\\xe6\\x04\\xb5>k}\\x85?\\xfe\\x9dm?f\\x83\\xec>\\xfe\\x9dm?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\x00\\x00' should start with b'facet normal'")
________ test_mass_properties_for_half_donut_with_density[binary-False] ________

binary_ascii_path = PosixPath('/build/python-numpy-stl/src/numpy-stl-3.1.2/tests/stl_binary')
speedups = False

    def test_mass_properties_for_half_donut_with_density(
            binary_ascii_path, speedups):
        '''
        Checks the results of method get_mass_properties_with_density() on
        STL ASCII and binary files HalfDonut.stl
        One checks the results obtained with stl
        with the ones obtained with meshlab
        '''
        filename = binary_ascii_path/'HalfDonut.stl'
        mesh = stl.StlMesh(str(filename), speedups=speedups)
        volume, mass, cog, inertia = mesh.get_mass_properties_with_density(1.23)
    
        assert close([mass], [2.882083302268982])
        assert close([volume], [2.343149026234945])
        assert close(cog, [1.500001, 0.209472, 1.500001])
        print('inertia')
        numpy.set_printoptions(suppress=True)
        print(inertia)
>       assert close(inertia, [[+1.71022851, +0.00000001, -0.00000011],
                               [+0.00000001, +3.32226227, +0.00000002],
                               [-0.00000011, +0.00000002, +1.71022859]])
E       assert False
E        +  where False = close(array([[1.71022246, 0.00000096, 0.00000203],\n       [0.00000096, 3.32226154, 0.000002  ],\n       [0.00000203, 0.000002  , 1.71023271]]), [[1.71022851, 1e-08, -1.1e-07], [1e-08, 3.32226227, 2e-08], [-1.1e-07, 2e-08, 1.71022859]])

tests/test_meshProperties.py:87: AssertionError
----------------------------- Captured stdout call -----------------------------
exception (False, "b'!\\xbc\\xafw\\x7f>\\xe6\\x04\\xb5>\\x88e{?l\\x08\\x9e>f\\x83\\xec>\\x00\\x00\\xc0?\\xd1v\\xcc>f\\x83\\xec>\\xbe\\xa4\\x85?\\x00\\x00\\xb1\\xf5e\\xbd\\xed\\x13\\xac=\\x9f\\xf76\\xbc\\xafw\\x7f>\\xe6\\x04\\xb5>\\x88e{?4\\xf6\\x15>\\xe6\\x04\\xb5>\\x00\\x00\\xc0?l\\x08\\x9e>f\\x83\\xec>\\x00\\x00\\xc0?\\x00\\x00\\xfamj\\xbc[\\xf6\\x95=\\x9c,\\x07\\xbc\\x15x(?f\\x83\\xec>\\x15x(?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\x00\\x00c\\x02q\\xbc0\\xa8\\xb2=\\xcf\\t!\\xbc\\x15x(?f\\x83\\xec>\\x15x(?\\xd1v\\xcc>f\\x83\\xec>\\xbe\\xa4\\x85?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\x00\\x00\\xfa\\x97#<\\xfa\\x88r=\\x85\\x9e\\xda;\\xfe\\x9dm?f\\x83\\xec>\\xfe\\x9dm?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\x00\\x00\\xfamj<\\x1f\\xf6\\x95=\\x9c,\\x07<\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\x00\\x00y8\\xba<\\x8c_$=\\xc0\\xd7x<k}\\x85?\\xe6\\x04\\xb5>k}\\x85?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?x\\x1bg?\\xe6\\x04\\xb5>\\xdau\\xa0?\\x00\\x00\\xbc\\xf0\\xe8<\\x19\\x9bm=b\\xa5\\x9b<k}\\x85?\\xe6\\x04\\xb5>k}\\x85?\\xfe\\x9dm?f\\x83\\xec>\\xfe\\x9dm?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\x00\\x00' should start with b'facet normal'")
inertia
[[1.71022246 0.00000096 0.00000203]
 [0.00000096 3.32226154 0.000002  ]
 [0.00000203 0.000002   1.71023271]]
------------------------------ Captured log call -------------------------------
WARNING  stl.base.BaseMesh:logger.py:109 Use of not exact is_closed check. This check can lead to misleading
            results. You could try to use `exact=True`.
            See:
             - false positive: https://github.com/wolph/numpy-stl/issues/198
             - false negative: https://github.com/wolph/numpy-stl/pull/213
________ test_mass_properties_for_half_donut_with_density[binary-True] _________

binary_ascii_path = PosixPath('/build/python-numpy-stl/src/numpy-stl-3.1.2/tests/stl_binary')
speedups = True

    def test_mass_properties_for_half_donut_with_density(
            binary_ascii_path, speedups):
        '''
        Checks the results of method get_mass_properties_with_density() on
        STL ASCII and binary files HalfDonut.stl
        One checks the results obtained with stl
        with the ones obtained with meshlab
        '''
        filename = binary_ascii_path/'HalfDonut.stl'
        mesh = stl.StlMesh(str(filename), speedups=speedups)
        volume, mass, cog, inertia = mesh.get_mass_properties_with_density(1.23)
    
        assert close([mass], [2.882083302268982])
        assert close([volume], [2.343149026234945])
        assert close(cog, [1.500001, 0.209472, 1.500001])
        print('inertia')
        numpy.set_printoptions(suppress=True)
        print(inertia)
>       assert close(inertia, [[+1.71022851, +0.00000001, -0.00000011],
                               [+0.00000001, +3.32226227, +0.00000002],
                               [-0.00000011, +0.00000002, +1.71022859]])
E       assert False
E        +  where False = close(array([[1.71022246, 0.00000096, 0.00000203],\n       [0.00000096, 3.32226154, 0.000002  ],\n       [0.00000203, 0.000002  , 1.71023271]]), [[1.71022851, 1e-08, -1.1e-07], [1e-08, 3.32226227, 2e-08], [-1.1e-07, 2e-08, 1.71022859]])

tests/test_meshProperties.py:87: AssertionError
----------------------------- Captured stdout call -----------------------------
exception (False, "b'!\\xbc\\xafw\\x7f>\\xe6\\x04\\xb5>\\x88e{?l\\x08\\x9e>f\\x83\\xec>\\x00\\x00\\xc0?\\xd1v\\xcc>f\\x83\\xec>\\xbe\\xa4\\x85?\\x00\\x00\\xb1\\xf5e\\xbd\\xed\\x13\\xac=\\x9f\\xf76\\xbc\\xafw\\x7f>\\xe6\\x04\\xb5>\\x88e{?4\\xf6\\x15>\\xe6\\x04\\xb5>\\x00\\x00\\xc0?l\\x08\\x9e>f\\x83\\xec>\\x00\\x00\\xc0?\\x00\\x00\\xfamj\\xbc[\\xf6\\x95=\\x9c,\\x07\\xbc\\x15x(?f\\x83\\xec>\\x15x(?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\x00\\x00c\\x02q\\xbc0\\xa8\\xb2=\\xcf\\t!\\xbc\\x15x(?f\\x83\\xec>\\x15x(?\\xd1v\\xcc>f\\x83\\xec>\\xbe\\xa4\\x85?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\x00\\x00\\xfa\\x97#<\\xfa\\x88r=\\x85\\x9e\\xda;\\xfe\\x9dm?f\\x83\\xec>\\xfe\\x9dm?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\x00\\x00\\xfamj<\\x1f\\xf6\\x95=\\x9c,\\x07<\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\t\\xfbj?\\x00\\x00\\x00?\\t\\xfbj?\\x9a|\\x13?\\x00\\x00\\x00?w\\x04\\x8f?\\x00\\x00y8\\xba<\\x8c_$=\\xc0\\xd7x<k}\\x85?\\xe6\\x04\\xb5>k}\\x85?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?x\\x1bg?\\xe6\\x04\\xb5>\\xdau\\xa0?\\x00\\x00\\xbc\\xf0\\xe8<\\x19\\x9bm=b\\xa5\\x9b<k}\\x85?\\xe6\\x04\\xb5>k}\\x85?\\xfe\\x9dm?f\\x83\\xec>\\xfe\\x9dm?\\xdc\\xbd@?f\\x83\\xec>\\x9dc\\x98?\\x00\\x00' should start with b'facet normal'")
inertia
[[1.71022246 0.00000096 0.00000203]
 [0.00000096 3.32226154 0.000002  ]
 [0.00000203 0.000002   1.71023271]]
------------------------------ Captured log call -------------------------------
WARNING  stl.base.BaseMesh:logger.py:109 Use of not exact is_closed check. This check can lead to misleading
            results. You could try to use `exact=True`.
            See:
             - false positive: https://github.com/wolph/numpy-stl/issues/198
             - false negative: https://github.com/wolph/numpy-stl/pull/213
=============================== warnings summary ===============================
../../../../usr/lib/python3.12/site-packages/_pytest/config/__init__.py:1437
  /usr/lib/python3.12/site-packages/_pytest/config/__init__.py:1437: PytestConfigWarning: Unknown config option: flake8-ignore
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_ascii.py::test_ascii_io[False] - ValueError: could not convert string to float: b'np.float32(0.0)'
FAILED tests/test_ascii.py::test_ascii_io[True] - ValueError: could not convert string to float: b'np.float32(0.0)'
FAILED tests/test_meshProperties.py::test_mass_properties_for_half_donut[ascii-False] - assert False
 +  where False = close(array([[1.39042477e+00, 7.83056320e-07, 1.65303997e-06],\n       [7.83056320e-07, 2.70102564e+00, 1.62463063e-06],\n       [1.65303997e-06, 1.62463063e-06, 1.39043310e+00]]), [[1.390429, 0.0, 0.0], [0.0, 2.701025, 0.0], [0.0, 0.0, 1.390429]])
FAILED tests/test_meshProperties.py::test_mass_properties_for_half_donut[ascii-True] - assert False
 +  where False = close(array([[1.39042477e+00, 7.83056320e-07, 1.65303997e-06],\n       [7.83056320e-07, 2.70102564e+00, 1.62463063e-06],\n       [1.65303997e-06, 1.62463063e-06, 1.39043310e+00]]), [[1.390429, 0.0, 0.0], [0.0, 2.701025, 0.0], [0.0, 0.0, 1.390429]])
FAILED tests/test_meshProperties.py::test_mass_properties_for_half_donut_with_density[ascii-False] - assert False
 +  where False = close(array([[1.71022246, 0.00000096, 0.00000203],\n       [0.00000096, 3.32226154, 0.000002  ],\n       [0.00000203, 0.000002  , 1.71023271]]), [[1.71022851, 1e-08, -1.1e-07], [1e-08, 3.32226227, 2e-08], [-1.1e-07, 2e-08, 1.71022859]])
FAILED tests/test_meshProperties.py::test_mass_properties_for_half_donut_with_density[ascii-True] - assert False
 +  where False = close(array([[1.71022246, 0.00000096, 0.00000203],\n       [0.00000096, 3.32226154, 0.000002  ],\n       [0.00000203, 0.000002  , 1.71023271]]), [[1.71022851, 1e-08, -1.1e-07], [1e-08, 3.32226227, 2e-08], [-1.1e-07, 2e-08, 1.71022859]])
FAILED tests/test_meshProperties.py::test_mass_properties_for_half_donut[binary-False] - assert False
 +  where False = close(array([[1.39042477, 0.00000078, 0.00000165],\n       [0.00000078, 2.70102564, 0.00000162],\n       [0.00000165, 0.00000162, 1.3904331 ]]), [[1.390429, 0.0, 0.0], [0.0, 2.701025, 0.0], [0.0, 0.0, 1.390429]])
FAILED tests/test_meshProperties.py::test_mass_properties_for_half_donut[binary-True] - assert False
 +  where False = close(array([[1.39042477, 0.00000078, 0.00000165],\n       [0.00000078, 2.70102564, 0.00000162],\n       [0.00000165, 0.00000162, 1.3904331 ]]), [[1.390429, 0.0, 0.0], [0.0, 2.701025, 0.0], [0.0, 0.0, 1.390429]])
FAILED tests/test_meshProperties.py::test_mass_properties_for_half_donut_with_density[binary-False] - assert False
 +  where False = close(array([[1.71022246, 0.00000096, 0.00000203],\n       [0.00000096, 3.32226154, 0.000002  ],\n       [0.00000203, 0.000002  , 1.71023271]]), [[1.71022851, 1e-08, -1.1e-07], [1e-08, 3.32226227, 2e-08], [-1.1e-07, 2e-08, 1.71022859]])
FAILED tests/test_meshProperties.py::test_mass_properties_for_half_donut_with_density[binary-True] - assert False
 +  where False = close(array([[1.71022246, 0.00000096, 0.00000203],\n       [0.00000096, 3.32226154, 0.000002  ],\n       [0.00000203, 0.000002  , 1.71023271]]), [[1.71022851, 1e-08, -1.1e-07], [1e-08, 3.32226227, 2e-08], [-1.1e-07, 2e-08, 1.71022859]])
============= 10 failed, 111 passed, 5 skipped, 1 warning in 5.97s =============
==> ERROR: A failure occurred in check().
@wolph
Copy link
Owner

wolph commented Aug 17, 2024

It seems that numpy 2.x has made some changes that cause many of the tests to fail. If you go back to numpy 1.x the tests will work again, but it will take some time to update all of the tests to work with numpy 2.

@wolph wolph changed the title ValueError: could not convert string to float: b'np.float32(0.0)' numpy 2.x breaks the tests: ValueError: could not convert string to float: b'np.float32(0.0)' Aug 17, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@tbaudier
Copy link
Contributor

I have the same problem,
I tried to do a PR here: #224

@github-actions github-actions bot removed the Stale label Sep 20, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Oct 20, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2024
@wolph
Copy link
Owner

wolph commented Nov 25, 2024

The new release with the fix is out now!

With a bit of luck I've fixed the configuration of the stalebot too... hard to debug that thing ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants