Show More
@@ -12,7 +12,6 b' import nose.tools as nt' | |||||
12 | # Our own |
|
12 | # Our own | |
13 | from IPython.testing import decorators as dec |
|
13 | from IPython.testing import decorators as dec | |
14 | from IPython.testing.skipdoctest import skip_doctest |
|
14 | from IPython.testing.skipdoctest import skip_doctest | |
15 | from IPython.testing.ipunittest import ParametricTestCase |
|
|||
16 |
|
15 | |||
17 | #----------------------------------------------------------------------------- |
|
16 | #----------------------------------------------------------------------------- | |
18 | # Utilities |
|
17 | # Utilities | |
@@ -47,24 +46,6 b' def trivial():' | |||||
47 | """A trivial test""" |
|
46 | """A trivial test""" | |
48 | pass |
|
47 | pass | |
49 |
|
48 | |||
50 | # Some examples of parametric tests. |
|
|||
51 |
|
||||
52 | def is_smaller(i,j): |
|
|||
53 | assert i<j,"%s !< %s" % (i,j) |
|
|||
54 |
|
||||
55 | class Tester(ParametricTestCase): |
|
|||
56 |
|
||||
57 | def test_parametric(self): |
|
|||
58 | yield is_smaller(3, 4) |
|
|||
59 | x, y = 1, 2 |
|
|||
60 | yield is_smaller(x, y) |
|
|||
61 |
|
||||
62 | @dec.parametric |
|
|||
63 | def test_par_standalone(): |
|
|||
64 | yield is_smaller(3, 4) |
|
|||
65 | x, y = 1, 2 |
|
|||
66 | yield is_smaller(x, y) |
|
|||
67 |
|
||||
68 |
|
49 | |||
69 | @dec.skip |
|
50 | @dec.skip | |
70 | def test_deliberately_broken(): |
|
51 | def test_deliberately_broken(): |
@@ -51,26 +51,24 b' def test_full_path_win32():' | |||||
51 | nt.assert_equal(result, ['c:\\a.txt']) |
|
51 | nt.assert_equal(result, ['c:\\a.txt']) | |
52 |
|
52 | |||
53 |
|
53 | |||
54 | @dec.parametric |
|
|||
55 | def test_parser(): |
|
54 | def test_parser(): | |
56 | err = ("FAILED (errors=1)", 1, 0) |
|
55 | err = ("FAILED (errors=1)", 1, 0) | |
57 | fail = ("FAILED (failures=1)", 0, 1) |
|
56 | fail = ("FAILED (failures=1)", 0, 1) | |
58 | both = ("FAILED (errors=1, failures=1)", 1, 1) |
|
57 | both = ("FAILED (errors=1, failures=1)", 1, 1) | |
59 | for txt, nerr, nfail in [err, fail, both]: |
|
58 | for txt, nerr, nfail in [err, fail, both]: | |
60 | nerr1, nfail1 = tt.parse_test_output(txt) |
|
59 | nerr1, nfail1 = tt.parse_test_output(txt) | |
61 |
|
|
60 | nt.assert_equal(nerr, nerr1) | |
62 |
|
|
61 | nt.assert_equal(nfail, nfail1) | |
|
62 | ||||
63 |
|
63 | |||
64 |
|
||||
65 | @dec.parametric |
|
|||
66 | def test_temp_pyfile(): |
|
64 | def test_temp_pyfile(): | |
67 | src = 'pass\n' |
|
65 | src = 'pass\n' | |
68 | fname, fh = tt.temp_pyfile(src) |
|
66 | fname, fh = tt.temp_pyfile(src) | |
69 |
|
|
67 | assert os.path.isfile(fname) | |
70 | fh.close() |
|
68 | fh.close() | |
71 | with open(fname) as fh2: |
|
69 | with open(fname) as fh2: | |
72 | src2 = fh2.read() |
|
70 | src2 = fh2.read() | |
73 |
|
|
71 | nt.assert_equal(src2, src) | |
74 |
|
72 | |||
75 | class TestAssertPrints(unittest.TestCase): |
|
73 | class TestAssertPrints(unittest.TestCase): | |
76 | def test_passing(self): |
|
74 | def test_passing(self): |
General Comments 0
You need to be logged in to leave comments.
Login now