def test_Sensitive(self): """ L{twisted.python.rebuild.Sensitive} """ from twisted.python import rebuild from twisted.python.rebuild import Sensitive class TestSensitive(Sensitive): def test_method(self): """ Dummy method """ testSensitive = TestSensitive() testSensitive.rebuildUpToDate() self.assertFalse(testSensitive.needRebuildUpdate()) # Test rebuilding a builtin class newException = rebuild.latestClass(Exception) if _PY3: self.assertEqual(repr(Exception), repr(newException)) else: self.assertIn('twisted.python.rebuild.Exception', repr(newException)) self.assertEqual(newException, testSensitive.latestVersionOf(newException)) # Test types.MethodType on method in class self.assertEqual( TestSensitive.test_method, testSensitive.latestVersionOf(TestSensitive.test_method)) # Test types.MethodType on method in instance of class self.assertEqual( testSensitive.test_method, testSensitive.latestVersionOf(testSensitive.test_method)) # Test a class self.assertEqual(TestSensitive, testSensitive.latestVersionOf(TestSensitive)) class Foo: """ Dummy class """ foo = Foo() # Test types.InstanceType self.assertEqual(foo, testSensitive.latestVersionOf(foo)) def myFunction(): """ Dummy method """ # Test types.FunctionType self.assertEqual(myFunction, testSensitive.latestVersionOf(myFunction))
def test_Sensitive(self): """ L{twisted.python.rebuild.Sensitive} """ from twisted.python import rebuild from twisted.python.rebuild import Sensitive class TestSensitive(Sensitive): def test_method(self): """ Dummy method """ testSensitive = TestSensitive() testSensitive.rebuildUpToDate() self.assertFalse(testSensitive.needRebuildUpdate()) # Test rebuilding a builtin class newException = rebuild.latestClass(Exception) if _PY3: self.assertEqual(repr(Exception), repr(newException)) else: self.assertIn('twisted.python.rebuild.Exception', repr(newException)) self.assertEqual(newException, testSensitive.latestVersionOf(newException)) # Test types.MethodType on method in class self.assertEqual(TestSensitive.test_method, testSensitive.latestVersionOf(TestSensitive.test_method)) # Test types.MethodType on method in instance of class self.assertEqual(testSensitive.test_method, testSensitive.latestVersionOf(testSensitive.test_method)) # Test a class self.assertEqual(TestSensitive, testSensitive.latestVersionOf(TestSensitive)) class Foo: """ Dummy class """ foo = Foo() # Test types.InstanceType self.assertEqual(foo, testSensitive.latestVersionOf(foo)) def myFunction(): """ Dummy method """ # Test types.FunctionType self.assertEqual(myFunction, testSensitive.latestVersionOf(myFunction))
def testBananaInteraction(self): from twisted.python import rebuild from twisted.spread import banana rebuild.latestClass(banana.Banana)
def testBananaInteraction(self): from twisted.python import rebuild from twisted.spread import banana rebuild.latestClass(banana.Banana)