-
Notifications
You must be signed in to change notification settings - Fork 295
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
findSolid errors #655
findSolid errors #655
Conversation
Removed a line in the findSolid docstring about raising an error if no solids found. Added exceptions to several methods that were previously failing with AttributeErrors when they tried to treat the None object as a solid.
Codecov Report
@@ Coverage Diff @@
## master #655 +/- ##
==========================================
+ Coverage 94.03% 94.19% +0.16%
==========================================
Files 31 31
Lines 6636 6683 +47
Branches 726 725 -1
==========================================
+ Hits 6240 6295 +55
+ Misses 258 253 -5
+ Partials 138 135 -3
Continue to review full report at Codecov.
|
I forgot about the |
Thanks for picking this up. Open question: isn't it better if |
Firstly, if I had of realised how large this PR was going to be I would have made an issue first and discussed this there. But honestly I was intending to take a 10 minute break from work and fix one line in the I thought about raising an exception in
On the other hand:
Now I've written all that out, I prefer raising in |
I am, yes. |
+1 |
|
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.
@marcus7070 Looks good, thanks!
Thanks @marcus7070 |
Workplane.findSolid
had an incorrect docstring about it raising a ValueError when it didn't find any solids. It actually just returns None, and this is behaviour that a few other methods rely on (union
for example). So I removed the line in the docstring.There were several methods that treated the return from
findSolid
as just a Solid, and hence were trying to call methods on theNone
object and failing with an AttributeError. I added checks forNone
and ValueError exceptions to these methods.Then I thought to myself, "This is mypy's job, why am I doing it?", and realised that
findSolid
needed the type hint Optional added to it's return value.I also added tests for all the new exceptions. I realised
cutEach
isn't tested at all (except for probably in the examples), so I added a basic test for that as well.