/unit_tests/support/bug105/tests.py

https://bitbucket.org/jpellerin/nose/ · Python · 49 lines · 44 code · 3 blank · 2 comment · 3 complexity · 86fe05d01bb85cedd900c049b0abbb8b MD5 · raw file

  1. from nose import tools
  2. def test_z():
  3. """(1) test z"""
  4. pass
  5. def test_a():
  6. """(2) test a"""
  7. pass
  8. def test_rz():
  9. """(3) Test with raises decorator"""
  10. raise TypeError("err")
  11. test_rz = tools.raises(TypeError)(test_rz)
  12. def decorate(func):
  13. func.attr = 1
  14. return func
  15. def dec_replace(func):
  16. def newfunc():
  17. func()
  18. pass
  19. return newfunc
  20. def dec_makedecorator(func):
  21. def newfunc():
  22. pass
  23. newfunc = tools.make_decorator(func)(newfunc)
  24. return newfunc
  25. def test_dz():
  26. """(4) Test with non-replacing decorator"""
  27. pass
  28. test_dz = decorate(test_dz)
  29. def test_rz():
  30. """(5) Test with replacing decorator"""
  31. pass
  32. test_rz = dec_replace(test_rz)
  33. def test_mdz():
  34. """(6) Test with make_decorator decorator"""
  35. pass
  36. test_mdz = dec_makedecorator(test_mdz)
  37. def test_b():
  38. """(7) test b"""
  39. pass