Skip to content

Commit f819976

Browse files
Future proofs dtype constraint tests, improves example test checks
1 parent 54efd4d commit f819976

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tripy/tests/test_examples.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ def __str__(self):
9393

9494

9595
def test_all_examples_tested():
96-
num_dirs = len([d for d in os.listdir(EXAMPLES_ROOT) if os.path.isdir(os.path.join(EXAMPLES_ROOT, d))])
97-
assert num_dirs == len(EXAMPLES), "Not all examples are being tested!"
96+
tested_examples = set(os.path.relpath(example.path, EXAMPLES_ROOT) for example in EXAMPLES)
97+
all_examples = set(d for d in os.listdir(EXAMPLES_ROOT) if os.path.isdir(os.path.join(EXAMPLES_ROOT, d)))
98+
assert tested_examples == all_examples, "Not all examples are being tested!"
9899

99100

100101
# We want to test our examples with both the latest commit and public build.

tripy/tests/utils/wrappers/test_datatype_constraints.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ def test_datatype_constraints(case: DtypeConstraintCase):
222222
outputs = make_list(case.func(**inputs))
223223

224224
# Some APIs do not generate Tensor outputs (e.g. `allclose`), so we don't need to evaluate those.
225-
# For DimensionSizes, we don't need to check the type either (they can only be one type)
226-
if not any(type(out) == tp.Tensor for out in outputs):
225+
if not any(isinstance(out, tp.Tensor) for out in outputs):
227226
return
228227

229228
expected_return_types = [

0 commit comments

Comments
 (0)