Files
cadquery/tests/test_jupyter.py
Adam Urbańczyk e00ac83f98 Implement importBrep and vtkPolyData export (#735)
* Implement importBrep

* Implement rw to/from stream

* Implement toVtkPolyData

* Implemented VTP export

* Added normals calculation

* use VTK for rendering in jupyter

* Added orientation marker

* Assy rendering in notebooks

* Implement export to vtkjs

* Store the env in the cqgi result

* VTK-based cq directive

* Support show_object and assy

* assy vrml export via vtk

* Use vtk in the docs

* Add slot dxf file

* Add vtk.js to the static files

* Use single renderer

* Ignore cq_directive code coverage

* Ignore missing docutils stubs

* Implement select

* Disable interaction dynamically

* Mention VTP in the docs

* Add path to the test reqs
2021-06-22 17:36:50 +09:30

28 lines
746 B
Python

from tests import BaseTest
import cadquery as cq
from cadquery.occ_impl.jupyter_tools import display
class TestJupyter(BaseTest):
def test_repr_javascript(self):
cube = cq.Workplane("XY").box(1, 1, 1)
assy = cq.Assembly().add(cube)
shape = cube.val()
self.assertIsInstance(shape, cq.occ_impl.shapes.Solid)
# Test no exception on rendering to js
js1 = shape._repr_javascript_()
js2 = cube._repr_javascript_()
js3 = assy._repr_javascript_()
assert "function render" in js1
assert "function render" in js2
assert "function render" in js3
def test_display_error(self):
with self.assertRaises(ValueError):
display(cq.Vector())