Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / lib / python2.7 / dist-packages / twisted / trial / test / | server ip : 172.67.156.115 your ip : 172.70.130.195 H O M E |
Filename | /usr/lib/python2.7/dist-packages/twisted/trial/test/sample.py |
Size | 2.06 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:56 |
Last modified | 23-Aug-2012 21:47 |
Last accessed | 07-Jul-2025 10:03 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
"""This module is used by test_loader to test the Trial test loading
functionality. Do NOT change the number of tests in this module. Do NOT change
the names the tests in this module.
"""
import unittest as pyunit
from twisted.trial import unittest
from twisted.python.util import mergeFunctionMetadata
class FooTest(unittest.SynchronousTestCase):
def test_foo(self):
pass
def test_bar(self):
pass
def badDecorator(fn):
"""
Decorate a function without preserving the name of the original function.
Always return a function with the same name.
"""
def nameCollision(*args, **kwargs):
return fn(*args, **kwargs)
return nameCollision
def goodDecorator(fn):
"""
Decorate a function and preserve the original name.
"""
def nameCollision(*args, **kwargs):
return fn(*args, **kwargs)
return mergeFunctionMetadata(fn, nameCollision)
class DecorationTest(unittest.SynchronousTestCase):
def test_badDecorator(self):
"""
This test method is decorated in a way that gives it a confusing name
that collides with another method.
"""
test_badDecorator = badDecorator(test_badDecorator)
def test_goodDecorator(self):
"""
This test method is decorated in a way that preserves its name.
"""
test_goodDecorator = goodDecorator(test_goodDecorator)
def renamedDecorator(self):
"""
This is secretly a test method and will be decorated and then renamed so
test discovery can find it.
"""
test_renamedDecorator = goodDecorator(renamedDecorator)
def nameCollision(self):
"""
This isn't a test, it's just here to collide with tests.
"""
class PyunitTest(pyunit.TestCase):
def test_foo(self):
pass
def test_bar(self):
pass
class NotATest(object):
def test_foo(self):
pass
class AlphabetTest(unittest.SynchronousTestCase):
def test_a(self):
pass
def test_b(self):
pass
def test_c(self):
pass
functionality. Do NOT change the number of tests in this module. Do NOT change
the names the tests in this module.
"""
import unittest as pyunit
from twisted.trial import unittest
from twisted.python.util import mergeFunctionMetadata
class FooTest(unittest.SynchronousTestCase):
def test_foo(self):
pass
def test_bar(self):
pass
def badDecorator(fn):
"""
Decorate a function without preserving the name of the original function.
Always return a function with the same name.
"""
def nameCollision(*args, **kwargs):
return fn(*args, **kwargs)
return nameCollision
def goodDecorator(fn):
"""
Decorate a function and preserve the original name.
"""
def nameCollision(*args, **kwargs):
return fn(*args, **kwargs)
return mergeFunctionMetadata(fn, nameCollision)
class DecorationTest(unittest.SynchronousTestCase):
def test_badDecorator(self):
"""
This test method is decorated in a way that gives it a confusing name
that collides with another method.
"""
test_badDecorator = badDecorator(test_badDecorator)
def test_goodDecorator(self):
"""
This test method is decorated in a way that preserves its name.
"""
test_goodDecorator = goodDecorator(test_goodDecorator)
def renamedDecorator(self):
"""
This is secretly a test method and will be decorated and then renamed so
test discovery can find it.
"""
test_renamedDecorator = goodDecorator(renamedDecorator)
def nameCollision(self):
"""
This isn't a test, it's just here to collide with tests.
"""
class PyunitTest(pyunit.TestCase):
def test_foo(self):
pass
def test_bar(self):
pass
class NotATest(object):
def test_foo(self):
pass
class AlphabetTest(unittest.SynchronousTestCase):
def test_a(self):
pass
def test_b(self):
pass
def test_c(self):
pass