-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the doctests #1340
Fix the doctests #1340
Conversation
other things i have noticed
|
@jf--- since i can't add you as reviewer... ping |
my mouse and keyboard don't want to connect anymore so i will take that as a sign that it is time to give up for today... |
all are fixed. |
the tests are failing because of something weird going on on the github side |
>>> with open('point.json', 'r') as f: # doctest: +SKIP | ||
... point = json.load(f, cls=DataDecoder) # doctest: +SKIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just out of curiosity why these needs to be skipped? So in doctest the read and writing to disk is not possible? If that's the case perhaps these kind of stuff can be loads
and dumps
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps this works now actually. will try again...
>>> from compas_viewer import Viewer # doctest: +SKIP | ||
>>> viewer = Viewer() # doctest: +SKIP | ||
>>> viewer.scene.add(line) # doctest: +SKIP | ||
>>> from compas_viewer import Viewer # doctest: +SKIP | ||
>>> viewer = Viewer() # doctest: +SKIP | ||
>>> viewer.scene.add(line) # doctest: +SKIP | ||
>>> viewer.scene.add(hyperbola) # doctest: +SKIP | ||
>>> viewer.scene.add(hyperbola.frame) # doctest: +SKIP | ||
>>> viewer.show() # doctest: +SKIP | ||
>>> viewer.show() # doctest: +SKIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in future we should remove them from API reference of core? (After we clean up and improve the documents of viewer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i agree. viewer stuff should not be in the docs. will already remove them...
>>> from compas.geometry import Line # doctest: +SKIP | ||
>>> from compas.geometry import Intersection # doctest: +SKIP | ||
>>> a = Line([0, 0, 0], [2, 0, 0]) # doctest: +SKIP | ||
>>> b = Line([1, 0, 0], [1, 1, 0]) # doctest: +SKIP | ||
>>> intersection = Intersection() # doctest: +SKIP | ||
>>> intersection.line_line(a, b) # doctest: +SKIP | ||
>>> intersection.number_of_intersections # doctest: +SKIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin required for these ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, this was more like an API test example. the class is not yet part of the public API...
@@ -138,7 +138,7 @@ def offset_polygon(polygon, distance, tol=None): | |||
>>> polygon = Polygon([(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)]) | |||
>>> offsetted_polygon = offset_polygon(polygon, 0.5) | |||
>>> offsetted_polygon | |||
Polygon[[0.5, 0.5, 0.0], [0.5, 0.5, 0.0], [0.5, 0.5, 0.0], [0.5, 0.5, 0.0]] | |||
[[0.5, 0.5, 0.0], [0.5, 0.5, 0.0], [0.5, 0.5, 0.0], [0.5, 0.5, 0.0]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this function return a Polygon object instead of list to align with the input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, the lower level function shouldn't. the version attached to the polygon class itself should...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see
@@ -491,7 +491,7 @@ def from_convex_hull(cls, points): | |||
-------- | |||
>>> from compas.geometry import Polyhedron | |||
>>> points = [[0, 0, 0], [1, 0, 0], [0, 1, 0]] | |||
>>> p = Polyhedron.from_convex_hull(points) | |||
>>> p = Polyhedron.from_convex_hull(points) # doctest: +SKIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we also have a way document the minimal plugins needed for certain functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just some random comments!
@tomvanmele this is exciting, is this PR tangential to #1340? |
which one do you mean? this one is #1340... |
@tomvanmele there's quite a bunch of conflicts now, but it would be cool to merge this |
What type of change is this?
Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.CHANGELOG.md
file in theUnreleased
section under the most fitting heading (e.g.Added
,Changed
,Removed
).invoke test
).invoke lint
).compas.datastructures.Mesh
.