From 7bbec60c0c6be1b7ac28140a51c53fbad19247bf Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 1 Nov 2016 13:20:05 -0400 Subject: [PATCH] Enable and fix doctests for the new randomgen module. --- test/__init__.py | 4 +++- test/randomgen.py | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/test/__init__.py b/test/__init__.py index bbcd4ab..1d7c9a9 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -14,6 +14,7 @@ from dunshire import cones from dunshire import errors from dunshire import matrices from dunshire import games +from test import randomgen from test import symmetric_linear_game_test def build_suite(): @@ -23,9 +24,10 @@ def build_suite(): suite = TestSuite() suite.addTest(DocTestSuite(cones)) suite.addTest(DocTestSuite(errors)) - suite.addTest(DocTestSuite(matrices)) suite.addTest(DocTestSuite(games)) + suite.addTest(DocTestSuite(matrices)) suite.addTest(DocTestSuite(symmetric_linear_game_test)) + suite.addTest(DocTestSuite(randomgen)) slg_tests = TestLoader().loadTestsFromModule(symmetric_linear_game_test) suite.addTest(slg_tests) return suite diff --git a/test/randomgen.py b/test/randomgen.py index ef1b19e..6513440 100644 --- a/test/randomgen.py +++ b/test/randomgen.py @@ -200,9 +200,10 @@ def random_skew_symmetric_matrix(dims): >>> A.size (3, 3) + >>> from dunshire.options import ABS_TOL >>> from dunshire.matrices import norm >>> A = random_skew_symmetric_matrix(random_natural()) - >>> norm(A + A.trans()) < options.ABS_TOL + >>> norm(A + A.trans()) < ABS_TOL True """ @@ -255,9 +256,12 @@ def random_lyapunov_like_icecream(dims): >>> L = random_lyapunov_like_icecream(3) >>> L.size (3, 3) + + >>> from dunshire.options import ABS_TOL + >>> from dunshire.matrices import inner_product >>> x = matrix([1,1,0]) >>> s = matrix([1,-1,0]) - >>> abs(inner_product(L*x, s)) < options.ABS_TOL + >>> abs(inner_product(L*x, s)) < ABS_TOL True """ -- 2.44.2