Skip to content

Commit

Permalink
removed outdated development (test) dependency admesh
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTesla committed Aug 9, 2024
1 parent a0e8dc4 commit acc1c57
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 43 deletions.
29 changes: 1 addition & 28 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pylint = "^3.2.6"
black = "^24.4.2"
isort = "^5.13.2"
pytest = "^8.3.2"
admesh = "^0.98.9"

[tool.isort]
line_length = 79
Expand Down
41 changes: 27 additions & 14 deletions tests/test_render.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import admesh
import subprocess

import pytest
from numba import njit

Expand All @@ -12,16 +13,28 @@ def sphere(x, y, z):

def test_render_sphere():
render.renderAndSave(sphere, "build/sphere.stl", 0.5)
stl = admesh.Stl("build/sphere.stl")
assert stl.stats["max"]["x"] > 19
assert stl.stats["max"]["x"] < 21
assert stl.stats["min"]["x"] < -19
assert stl.stats["min"]["x"] > -21
assert stl.stats["max"]["y"] > 19
assert stl.stats["max"]["y"] < 21
assert stl.stats["min"]["y"] < -19
assert stl.stats["min"]["y"] > -21
assert stl.stats["max"]["z"] > 19
assert stl.stats["max"]["z"] < 21
assert stl.stats["min"]["z"] < -19
assert stl.stats["min"]["z"] > -21
rv = subprocess.run(["admesh", "build/sphere.stl"], stdout=subprocess.PIPE)
lines = rv.stdout.decode(errors="ignore").split("\n")
lc = [e for e in lines if ":" in e]
dcs = {
e.split(":")[0].strip(): e.split(":")[1].strip().split(" ", 1)[0] for e in lc
}
dc = {k: int(v) if v.isdigit() else v for k, v in dcs.items()}
ld = [f.strip() for e in lines if "," in e and "=" in e for f in e.split(",")]
dd = {
e.split("=")[0].strip(): float(e.split("=")[1].strip().split(" ", 1)[0])
for e in ld
}
stats = {**dc, **dd}
assert stats["Max X"] > 19
assert stats["Max X"] < 21
assert stats["Min X"] < -19
assert stats["Min X"] > -21
assert stats["Max Y"] > 19
assert stats["Max Y"] < 21
assert stats["Min Y"] < -19
assert stats["Min Y"] > -21
assert stats["Max Z"] > 19
assert stats["Max Z"] < 21
assert stats["Min Z"] < -19
assert stats["Min Z"] > -21

0 comments on commit acc1c57

Please sign in to comment.