K2LL33D SHELL

 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 : 104.21.89.46

your ip : 172.70.127.50

H O M E


Filename/usr/lib/python2.7/dist-packages/twisted/persisted/test/test_styles.py
Size1.18 kb
Permissionrw-r--r--
Ownerroot : root
Create time27-Apr-2025 09:56
Last modified27-Mar-2011 08:56
Last accessed07-Jul-2025 02:28
Actionsedit | rename | delete | download (gzip)
Viewtext | 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)