| 63 | "code, path", chain(find_examples(), find_examples_in_docs()), ids=count(0) |
| 64 | ) |
| 65 | def test_example(code, path, tmpdir): |
| 66 | |
| 67 | # build |
| 68 | with chdir(tmpdir): |
| 69 | # tmpdir is for future use; currently there are no examples that export files |
| 70 | res = cqgi.parse(code).build() |
| 71 | |
| 72 | assert res.exception is None |
| 73 | |
| 74 | # check if the resulting objects are valid |
| 75 | for r in res.results: |
| 76 | r = r.shape |
| 77 | if isinstance(r, cq.Workplane): |
| 78 | for v in r.vals(): |
| 79 | if isinstance(v, cq.Shape): |
| 80 | assert v.isValid() |
| 81 | elif isinstance(r, cq.Shape): |
| 82 | assert r.isValid() |