Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SNAPPYTutorial02
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WEISS
Software Repositories
SNAPPY
SNAPPYTutorial02
Compare Revisions
ac0fdf0ac380f99be16387529a3a14d36e56379a...84cc33ef4671440cc1bb085ef2115ac25cd440df
Source
84cc33ef4671440cc1bb085ef2115ac25cd440df
Select Git revision
...
Target
ac0fdf0ac380f99be16387529a3a14d36e56379a
Select Git revision
Compare
Commits (2)
Issue
#8
used assert approximately equal in testing
· ba0deb75
Stephen Thompson
authored
Aug 14, 2019
ba0deb75
Issue
#8
tidied indent
· 84cc33ef
Stephen Thompson
authored
Aug 14, 2019
84cc33ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
doc/06_Testing.rst
doc/06_Testing.rst
+8
-2
No files found.
doc/06_Testing.rst
View file @
84cc33ef
...
@@ -76,11 +76,16 @@ we removed them and replaced them with sphere_fitting.py, so let's update the im
...
@@ -76,11 +76,16 @@ we removed them and replaced them with sphere_fitting.py, so let's update the im
from sksurgeryspherefitting.algorithms import sphere_fitting
from sksurgeryspherefitting.algorithms import sphere_fitting
Also add an import numpy, so we can use it's approximately equal function.
::
import numpy
Now scroll down and delete the two unit tests for addition and subtraction, replacing them
Now scroll down and delete the two unit tests for addition and subtraction, replacing them
with a test for fit_sphere_least_squares
with a test for fit_sphere_least_squares
::
::
def test_fit_sphere_least_squares():
def test_fit_sphere_least_squares():
x_centre = 1.0
x_centre = 1.0
y_centre = 167.0
y_centre = 167.0
z_centre = 200.0
z_centre = 200.0
...
@@ -113,7 +118,8 @@ with a test for fit_sphere_least_squares
...
@@ -113,7 +118,8 @@ with a test for fit_sphere_least_squares
y_values,
y_values,
z_values,
z_values,
parameters)
parameters)
assert result[0][0] == x_centre
numpy.testing.assert_approx_equal(result[0][0], x_centre, significant=10)
We've used some functions from numpy, so don't forget to add import numpy at the top of the test file;
We've used some functions from numpy, so don't forget to add import numpy at the top of the test file;
::
::
...
...