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 / persisted / test / | server ip : 172.67.156.115 your ip : 172.69.130.111 H O M E |
Filename | /usr/lib/python2.7/dist-packages/twisted/persisted/test/test_styles.py |
Size | 1.18 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:56 |
Last modified | 27-Mar-2011 08:56 |
Last accessed | 07-Jul-2025 02:28 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.persisted.styles}.
"""
from twisted.trial import unittest
from twisted.persisted.styles import unpickleMethod
class Foo:
"""
Helper class.
"""
def method(self):
"""
Helper method.
"""
class Bar:
"""
Helper class.
"""
class UnpickleMethodTestCase(unittest.TestCase):
"""
Tests for the unpickleMethod function.
"""
def test_instanceBuildingNamePresent(self):
"""
L{unpickleMethod} returns an instance method bound to the
instance passed to it.
"""
foo = Foo()
m = unpickleMethod('method', foo, Foo)
self.assertEqual(m, foo.method)
self.assertNotIdentical(m, foo.method)
def test_instanceBuildingNameNotPresent(self):
"""
If the named method is not present in the class,
L{unpickleMethod} finds a method on the class of the instance
and returns a bound method from there.
"""
foo = Foo()
m = unpickleMethod('method', foo, Bar)
self.assertEqual(m, foo.method)
self.assertNotIdentical(m, foo.method)
# See LICENSE for details.
"""
Tests for L{twisted.persisted.styles}.
"""
from twisted.trial import unittest
from twisted.persisted.styles import unpickleMethod
class Foo:
"""
Helper class.
"""
def method(self):
"""
Helper method.
"""
class Bar:
"""
Helper class.
"""
class UnpickleMethodTestCase(unittest.TestCase):
"""
Tests for the unpickleMethod function.
"""
def test_instanceBuildingNamePresent(self):
"""
L{unpickleMethod} returns an instance method bound to the
instance passed to it.
"""
foo = Foo()
m = unpickleMethod('method', foo, Foo)
self.assertEqual(m, foo.method)
self.assertNotIdentical(m, foo.method)
def test_instanceBuildingNameNotPresent(self):
"""
If the named method is not present in the class,
L{unpickleMethod} finds a method on the class of the instance
and returns a bound method from there.
"""
foo = Foo()
m = unpickleMethod('method', foo, Bar)
self.assertEqual(m, foo.method)
self.assertNotIdentical(m, foo.method)