test: 3d exporters work with all types of paths

This commit is contained in:
Ethan Rooke 2024-11-14 21:11:36 -06:00
parent cada1d4239
commit 30d23d8669
No known key found for this signature in database
GPG key ID: B2874A77049A5923

View file

@ -30,12 +30,15 @@ import os
import re
import unittest
from typing import Optional
from pathlib import Path
import pytest
from build123d.build_common import GridLocations
from build123d.build_enums import Unit
from build123d.build_line import BuildLine
from build123d.build_sketch import BuildSketch
from build123d.exporters3d import export_gltf, export_step
from build123d.exporters3d import export_gltf, export_step, export_brep, export_stl
from build123d.geometry import Color, Pos, Vector, VectorLike
from build123d.objects_curve import Line
from build123d.objects_part import Box, Sphere
@ -165,5 +168,17 @@ class TestExportGltf(DirectApiTestCase):
# os.remove("box.bin")
@pytest.mark.parametrize(
"format", (Path, os.fsencode, os.fsdecode), ids=["path", "bytes", "str"]
)
@pytest.mark.parametrize(
"exporter", (export_gltf, export_stl, export_step, export_brep)
)
def test_pathlike_exporters(tmp_path, format, exporter):
path = format(tmp_path / "file")
box = Box(1, 1, 1).locate(Pos(-1, -2, -3))
exporter(box, path)
if __name__ == "__main__":
unittest.main()