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