test: one geometric tolerance for the parity tests (1e-4), not one exception per case
Areas, volumes and bounding boxes of the parity tests come out of OpenCASCADE's numerical integration and optimisation, which differ between OCCT builds at the 1e-5 level. GEOMETRY_REL (ref.py) is the default of every comparison helper; counts, names, ids and strings are still compared exactly. Replaces the per-name exception for the modeled-thread areas. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,7 @@ class _Native:
|
||||
|
||||
native = _Native()
|
||||
|
||||
from ref import close, golden
|
||||
from ref import GEOMETRY_REL, close, golden
|
||||
|
||||
_PRELUDE = '''
|
||||
import math
|
||||
@@ -116,7 +116,7 @@ def solved_summary(solved):
|
||||
'''
|
||||
|
||||
|
||||
def mismatches(actual, expected, path="result", rel=1e-6, abs_=1e-9):
|
||||
def mismatches(actual, expected, path="result", rel=GEOMETRY_REL, abs_=1e-9):
|
||||
"""Where `actual` and `expected` differ, one line each (empty when they agree)."""
|
||||
if isinstance(actual, dict) and isinstance(expected, dict):
|
||||
out = []
|
||||
@@ -138,7 +138,7 @@ def run_native(source: str):
|
||||
return json.loads(json.dumps(namespace["result"], default=float))
|
||||
|
||||
|
||||
def parity(name: str, source: str, rel: float = 1e-6, abs_: float = 1e-9, ignore=()):
|
||||
def parity(name: str, source: str, rel: float = GEOMETRY_REL, abs_: float = 1e-9, ignore=()):
|
||||
"""Run `source` on both sides and assert that `result` agrees; keys in `ignore` are dropped first."""
|
||||
source = textwrap.dedent(source)
|
||||
expected = golden(f"product_{name}", _PRELUDE + "\n" + source)
|
||||
|
||||
Reference in New Issue
Block a user