Open Media Library Platform

This commit is contained in:
j 2013-10-11 19:28:32 +02:00
commit 411ad5b16f
5849 changed files with 1778641 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.persisted}.
"""

View file

@ -0,0 +1,55 @@
# 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)