From 68f4f03baa7391956565893428839dd3e65abadb Mon Sep 17 00:00:00 2001 From: jack-parsons <jack.parsons.uk@icloud.com> Date: Wed, 24 Jul 2019 12:27:57 +0100 Subject: [PATCH] Adding registration doctests --- .gitlab-ci.yml | 2 ++ AmpScan/registration.py | 8 ++++++-- tests/doctests.py | 8 -------- tests/stl_file_2.stl | 3 +++ 4 files changed, 11 insertions(+), 10 deletions(-) delete mode 100644 tests/doctests.py create mode 100644 tests/stl_file_2.stl diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2c84dc..8f33e95 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,3 +2,5 @@ unittests: script: python -m unittest discover tests -v core doctests: script: python -m doctest -v AmpScan/core.py +registration doctests: + script: python -m doctest -v AmpScan/registration.py \ No newline at end of file diff --git a/AmpScan/registration.py b/AmpScan/registration.py index ce10583..b09c12a 100644 --- a/AmpScan/registration.py +++ b/AmpScan/registration.py @@ -6,7 +6,7 @@ Copyright: Joshua Steer 2018, Joshua.Steer@soton.ac.uk import numpy as np import copy from scipy import spatial -from .core import AmpObject +from AmpScan.core import AmpObject import matplotlib.pyplot as plt class registration(object): @@ -36,9 +36,13 @@ class registration(object): Examples -------- + >>> import os + >>> import AmpScan + >>> basefh = os.getcwd()+"\\tests\\stl_file.stl" + >>> targfh = os.getcwd()+"\\tests\\stl_file_2.stl" >>> baseline = AmpScan.AmpObject(basefh) >>> target = AmpScan.AmpObject(targfh) - >>> reg = AmpScan.registration(steps=10, neigh=10, smooth=1).reg + >>> reg = AmpScan.registration(baseline, target, steps=10, neigh=10, smooth=1).reg """ def __init__(self, baseline, target, method='point2plane', *args, **kwargs): diff --git a/tests/doctests.py b/tests/doctests.py deleted file mode 100644 index 66e71b2..0000000 --- a/tests/doctests.py +++ /dev/null @@ -1,8 +0,0 @@ -import AmpScan.core as core -import AmpScan.trim as trim - -if __name__ == '__main__': - import doctest - doctest.testmod(core, verbose=True) - doctest.testmod(trim, verbose=True) - diff --git a/tests/stl_file_2.stl b/tests/stl_file_2.stl new file mode 100644 index 0000000..5b51ee5 --- /dev/null +++ b/tests/stl_file_2.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bd80b6e237a78b9968f4649f415718e58f8ca7a10db759f8d6fa55115c2a826 +size 757084 -- GitLab