Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
AmpScan
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Joshua Steer
AmpScan
Commits
2ce1d57b
Commit
2ce1d57b
authored
5 years ago
by
jack-parsons
Browse files
Options
Downloads
Patches
Plain Diff
Beefing up rotation test
parent
ccf7f33a
No related branches found
No related tags found
1 merge request
!23
Merge in Jack's changes
Pipeline
#850
passed
5 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/basic_tests.py
+1
-0
1 addition, 0 deletions
tests/basic_tests.py
tests/core_tests.py
+18
-5
18 additions, 5 deletions
tests/core_tests.py
tests/sample_test.py
+0
-2
0 additions, 2 deletions
tests/sample_test.py
with
19 additions
and
7 deletions
tests/basic_tests.py
+
1
−
0
View file @
2ce1d57b
...
...
@@ -16,6 +16,7 @@ def suite():
class
TestBasicFunction
(
unittest
.
TestCase
):
def
test_setup
(
self
):
"""
Tests that the path can be obtained
"""
modPath
=
os
.
path
.
abspath
(
os
.
getcwd
())
sys
.
path
.
insert
(
0
,
modPath
)
...
...
This diff is collapsed.
Click to expand it.
tests/core_tests.py
+
18
−
5
View file @
2ce1d57b
...
...
@@ -4,6 +4,7 @@ Testing suite for the core functionality
import
unittest
import
os
import
numpy
as
np
def
suite
():
...
...
@@ -14,11 +15,12 @@ def suite():
class
TestCore
(
unittest
.
TestCase
):
ACCURACY
=
5
# The number of decimal places to value accuracy for
ACCURACY
=
5
# The number of decimal places to value accuracy for
- needed due to floating point inaccuracies
def
setUp
(
self
):
"""
Set up the AmpObject object from
"
sample_stl_sphere_BIN.stl
"
Runs before each unit test
Sets up the AmpObject object using
"
sample_stl_sphere_BIN.stl
"
"""
from
AmpScan.core
import
AmpObject
stl_path
=
self
.
get_path
(
"
sample_stl_sphere_BIN.stl
"
)
...
...
@@ -42,11 +44,22 @@ class TestCore(unittest.TestCase):
"""
Tests the rotate method of AmpObject
"""
s
=
str
(
type
(
self
.
amp
))
self
.
assertEqual
(
s
,
"
<class
'
AmpScan.core.AmpObject
'
>
"
,
"
Not expected Object
"
)
# Test rotation on first node
rot
=
[
np
.
pi
/
2
,
-
np
.
pi
/
4
,
np
.
pi
/
3
]
before_vert_pos
=
self
.
amp
.
vert
[
0
][:]
self
.
amp
.
rotateAng
(
rot
)
after_vert_pos
=
self
.
amp
.
vert
[
0
][:]
np
.
dot
(
before_vert_pos
,
rot
)
self
.
assertAlmostEqual
(
before_vert_pos
,
after_vert_pos
,
TestCore
.
ACCURACY
)
# Check single floats cause TypeError
with
self
.
assertRaises
(
TypeError
):
self
.
amp
.
rotateAng
(
7
)
self
.
amp
.
rotateAng
({})
# Check dictionaries cause TypeError
with
self
.
assertRaises
(
TypeError
):
self
.
amp
.
rotateAng
(
dict
())
def
test_translate
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
tests/sample_test.py
+
0
−
2
View file @
2ce1d57b
import
unittest
import
os
import
sys
import
core_tests
import
basic_tests
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment