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
17c654f5
Commit
17c654f5
authored
5 years ago
by
jack-parsons
Browse files
Options
Downloads
Patches
Plain Diff
Updating docs
parent
ad777bbc
Branches
Branches containing commit
No related tags found
1 merge request
!23
Merge in Jack's changes
Pipeline
#856
passed
5 years ago
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
tests/__init__.py
+0
-0
0 additions, 0 deletions
tests/__init__.py
tests/test_basics.py
+2
-6
2 additions, 6 deletions
tests/test_basics.py
tests/test_core.py
+6
-16
6 additions, 16 deletions
tests/test_core.py
tests/test_trim.py
+3
-7
3 additions, 7 deletions
tests/test_trim.py
with
11 additions
and
29 deletions
tests/__init__.py
deleted
100644 → 0
+
0
−
0
View file @
ad777bbc
This diff is collapsed.
Click to expand it.
tests/test_basics.py
+
2
−
6
View file @
17c654f5
...
...
@@ -14,9 +14,7 @@ class TestBasicFunction(unittest.TestCase):
sys
.
path
.
insert
(
0
,
modPath
)
def
test_python_imports
(
self
):
"""
Test imports
"""
"""
Test imports
"""
import
numpy
,
scipy
,
matplotlib
,
vtk
,
AmpScan
.
core
s
=
str
(
type
(
numpy
))
self
.
assertEqual
(
s
,
"
<class
'
module
'
>
"
)
...
...
@@ -31,8 +29,6 @@ class TestBasicFunction(unittest.TestCase):
@unittest.expectedFailure
def
test_failure
(
self
):
"""
Test expected failure functionality of test suite
"""
"""
Test expected failure functionality of test suite
"""
s
=
str
(
type
(
"
string
"
))
self
.
assertEqual
(
s
,
"
<class
'
module
'
>
"
)
This diff is collapsed.
Click to expand it.
tests/test_core.py
+
6
−
16
View file @
17c654f5
"""
Testing suite for the core
functionality
Testing suite for the core
module
"""
import
unittest
...
...
@@ -21,9 +21,7 @@ class TestCore(unittest.TestCase):
self
.
amp
=
AmpObject
(
stl_path
)
def
test_centre
(
self
):
"""
Test the centre method of AmpObject
"""
"""
Test the centre method of AmpObject
"""
# Translate the mesh
self
.
amp
.
translate
([
1
,
0
,
0
])
...
...
@@ -35,9 +33,7 @@ class TestCore(unittest.TestCase):
self
.
assertTrue
(
all
(
centre
[
i
]
<
(
10
**-
TestCore
.
ACCURACY
)
for
i
in
range
(
3
)))
def
test_rotate_ang
(
self
):
"""
Tests the rotateAng method of AmpObject
"""
"""
Tests the rotateAng method of AmpObject
"""
# Test rotation on random node
n
=
randrange
(
len
(
self
.
amp
.
vert
))
...
...
@@ -59,9 +55,7 @@ class TestCore(unittest.TestCase):
self
.
amp
.
rotateAng
(
dict
())
def
test_rotate
(
self
):
"""
Tests the rotate method of AmpObject
"""
"""
Tests the rotate method of AmpObject
"""
# A test rotation and translation using list
m
=
[[
1
,
0
,
0
],
[
0
,
np
.
sqrt
(
3
)
/
2
,
1
/
2
],
[
0
,
-
1
/
2
,
np
.
sqrt
(
3
)
/
2
]]
self
.
amp
.
rotate
(
m
)
...
...
@@ -83,9 +77,7 @@ class TestCore(unittest.TestCase):
self
.
amp
.
rotate
([[],
[],
[]])
def
test_translate
(
self
):
"""
Test translating method of AmpObject
"""
"""
Test translating method of AmpObject
"""
# Check that everything has been translated correctly to a certain accuracy
start
=
self
.
amp
.
vert
.
mean
(
axis
=
0
).
copy
()
...
...
@@ -108,9 +100,7 @@ class TestCore(unittest.TestCase):
self
.
amp
.
translate
([
0
,
0
,
0
,
0
])
def
test_rigid_transform
(
self
):
"""
Test the rigid transform method of AmpObject
"""
"""
Test the rigid transform method of AmpObject
"""
# Test if no transform is applied, vertices aren't affected
before_vert
=
self
.
amp
.
vert
.
copy
()
...
...
This diff is collapsed.
Click to expand it.
tests/test_trim.py
+
3
−
7
View file @
17c654f5
...
...
@@ -8,8 +8,7 @@ import os
class
TestTrim
(
unittest
.
TestCase
):
def
setUp
(
self
):
"""
Runs before each unit test
"""
Runs before each unit test
Sets up the AmpObject object using
"
sample_stl_sphere_BIN.stl
"
"""
from
AmpScan.core
import
AmpObject
...
...
@@ -17,16 +16,13 @@ class TestTrim(unittest.TestCase):
self
.
amp
=
AmpObject
(
stl_path
)
def
test_trim
(
self
):
"""
a new test for the trim module
"""
"""
Tests the trim method of AmpObject
"""
with
self
.
assertRaises
(
TypeError
):
self
.
amp
.
planarTrim
([],
plane
=
[])
@staticmethod
def
get_path
(
filename
):
"""
Returns the absolute path to the testing files
"""
Returns the absolute path to the testing files
:param filename: Name of the file in tests folder
:return: The absolute path to the file
...
...
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