mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-15 15:20:37 -08:00
test: mesher works with pathlike objects
This commit is contained in:
parent
28b82b85aa
commit
7b7c2e07b1
1 changed files with 16 additions and 0 deletions
|
|
@ -1,5 +1,10 @@
|
|||
import unittest, uuid
|
||||
from packaging.specifiers import SpecifierSet
|
||||
from pathlib import Path
|
||||
from os import fsdecode, fsencode
|
||||
|
||||
import pytest
|
||||
|
||||
from build123d.build_enums import MeshType, Unit
|
||||
from build123d.build_part import BuildPart
|
||||
from build123d.build_sketch import BuildSketch
|
||||
|
|
@ -206,5 +211,16 @@ class TestImportDegenerateTriangles(unittest.TestCase):
|
|||
self.assertEqual(sum(f.area == 0 for f in stl.faces()), 0)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"format", (Path, fsencode, fsdecode), ids=["path", "bytes", "str"]
|
||||
)
|
||||
def test_pathlike_mesher(tmp_path, format):
|
||||
path = format(tmp_path / "test.3mf")
|
||||
exporter, importer = Mesher(), Mesher()
|
||||
exporter.add_shape(Solid.make_box(1, 1, 1))
|
||||
exporter.write(path)
|
||||
importer.read(path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue