PageRenderTime 35ms CodeModel.GetById 27ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/unit_tests/support/bug105/tests.py

https://bitbucket.org/jpellerin/nose/
Python | 49 lines | 32 code | 10 blank | 7 comment | 0 complexity | 86fe05d01bb85cedd900c049b0abbb8b MD5 | raw file
 1from nose import tools
 2
 3def test_z():
 4    """(1) test z"""
 5    pass
 6
 7def test_a():
 8    """(2) test a"""
 9    pass
10
11def test_rz():
12    """(3) Test with raises decorator"""
13    raise TypeError("err")
14test_rz = tools.raises(TypeError)(test_rz)
15
16def decorate(func):
17    func.attr = 1
18    return func
19
20def dec_replace(func):
21    def newfunc():
22        func()
23        pass
24    return newfunc
25
26def dec_makedecorator(func):
27    def newfunc():
28        pass
29    newfunc = tools.make_decorator(func)(newfunc)
30    return newfunc
31
32def test_dz():
33    """(4) Test with non-replacing decorator"""
34    pass
35test_dz = decorate(test_dz)
36
37def test_rz():
38    """(5) Test with replacing decorator"""
39    pass
40test_rz = dec_replace(test_rz)
41
42def test_mdz():
43    """(6) Test with make_decorator decorator"""
44    pass
45test_mdz = dec_makedecorator(test_mdz)
46
47def test_b():
48    """(7) test b"""
49    pass