[python-dtcwt] 290/497: tests: move registration frame loading to utility function

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.

commit 2983ccd7a478046f26d84263b5e63f0812bc0943
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Fri Jan 31 12:42:22 2014 +0000

    tests: move registration frame loading to utility function
    
    Add a new module, tests.datasets, which will have functions for loading
    test datasets.
---
 tests/datasets.py         | 7 +++++++
 tests/testregistration.py | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/datasets.py b/tests/datasets.py
new file mode 100644
index 0000000..617ca66
--- /dev/null
+++ b/tests/datasets.py
@@ -0,0 +1,7 @@
+import os
+import numpy as np
+
+def regframes(name):
+    """Load the *name* registration dataset and return source and reference frame."""
+    frames = np.load(os.path.join(os.path.dirname(__file__), name + '.npz'))
+    return frames['f1'], frames['f2']
diff --git a/tests/testregistration.py b/tests/testregistration.py
index 68d5cd2..f4a21d1 100644
--- a/tests/testregistration.py
+++ b/tests/testregistration.py
@@ -6,11 +6,11 @@ import dtcwt
 from dtcwt.backend.backend_numpy import Transform2d
 from dtcwt.registration import *
 
+import tests.datasets as datasets
+
 def setup():
     global f1, f2
-    frames = np.load(os.path.join(os.path.dirname(__file__), 'traffic.npz'))
-    f1 = frames['f1']
-    f2 = frames['f2']
+    f1, f2 = datasets.regframes('traffic')
 
 def test_frames_loaded():
     assert f1.shape == (576, 768)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git



More information about the debian-science-commits mailing list