Exemplo n.º 1
0
 def test_deprecation(self):
     """
     Calling L{findObject} results in a deprecation warning
     """
     util.findObject('')
     warningsShown = self.flushWarnings()
     self.assertEquals(len(warningsShown), 1)
     self.assertIdentical(warningsShown[0]['category'], DeprecationWarning)
     self.assertEquals(warningsShown[0]['message'],
                       "twisted.trial.util.findObject was deprecated "
                       "in Twisted 10.1.0: Please use "
                       "twisted.python.reflect.namedAny instead.")
 def test_deprecation(self):
     """
     Calling L{findObject} results in a deprecation warning
     """
     util.findObject('')
     warningsShown = self.flushWarnings()
     self.assertEqual(len(warningsShown), 1)
     self.assertIdentical(warningsShown[0]['category'], DeprecationWarning)
     self.assertEqual(
         warningsShown[0]['message'],
         "twisted.trial.util.findObject was deprecated "
         "in Twisted 10.1.0: Please use "
         "twisted.python.reflect.namedAny instead.")
Exemplo n.º 3
0
 def test_importNonexistentPackage(self):
     self.failUnlessEqual(util.findObject('doesntexist')[0], False)
 def test_findNonexistentObject(self):
     self.assertEqual(
         util.findObject('goodpackage.test_sample.doesnt')[0], False)
     self.assertEqual(
         util.findObject('goodpackage.test_sample.AlphabetTest.doesntexist')
         [0], False)
 def test_findObjectExist(self):
     alpha1 = util.findObject('goodpackage.test_sample.AlphabetTest')
     from goodpackage import test_sample
     self.assertEqual(alpha1, (True, test_sample.AlphabetTest))
 def test_importNonexistentPackage(self):
     self.assertEqual(util.findObject('doesntexist')[0], False)
 def test_findNonexistentModule(self):
     self.assertEqual(util.findObject('package.doesntexist')[0], False)
Exemplo n.º 8
0
 def test_findNonexistentObject(self):
     self.failUnlessEqual(util.findObject(
         'goodpackage.test_sample.doesnt')[0], False)
     self.failUnlessEqual(util.findObject(
         'goodpackage.test_sample.AlphabetTest.doesntexist')[0], False)
Exemplo n.º 9
0
 def test_findObjectExist(self):
     alpha1 = util.findObject('goodpackage.test_sample.AlphabetTest')
     from goodpackage import test_sample
     self.failUnlessEqual(alpha1, (True, test_sample.AlphabetTest))
Exemplo n.º 10
0
 def test_importPackage(self):
     package1 = util.findObject('package')
     import package as package2
     self.assertEqual(package1, (True, package2))
Exemplo n.º 11
0
 def test_importNonexistentPackage(self):
     self.assertEqual(util.findObject("doesntexist")[0], False)
Exemplo n.º 12
0
 def test_importPackage(self):
     package1 = util.findObject('package')
     import package as package2
     self.failUnlessEqual(package1, (True, package2))
Exemplo n.º 13
0
 def test_importModule(self):
     test_sample2 = util.findObject('goodpackage.test_sample')
     from goodpackage import test_sample
     self.failUnlessEqual((True, test_sample), test_sample2)
Exemplo n.º 14
0
    def test_importModule(self):
        test_sample2 = util.findObject("goodpackage.test_sample")
        from goodpackage import test_sample

        self.assertEqual((True, test_sample), test_sample2)
Exemplo n.º 15
0
    def test_importPackage(self):
        package1 = util.findObject("package")
        import package as package2

        self.assertEqual(package1, (True, package2))
Exemplo n.º 16
0
    def test_findObjectExist(self):
        alpha1 = util.findObject("goodpackage.test_sample.AlphabetTest")
        from goodpackage import test_sample

        self.assertEqual(alpha1, (True, test_sample.AlphabetTest))
Exemplo n.º 17
0
 def test_findNonexistentObject(self):
     self.assertEqual(util.findObject("goodpackage.test_sample.doesnt")[0], False)
     self.assertEqual(util.findObject("goodpackage.test_sample.AlphabetTest.doesntexist")[0], False)
Exemplo n.º 18
0
 def test_findNonexistentModule(self):
     self.assertEqual(util.findObject("package.doesntexist")[0], False)
Exemplo n.º 19
0
 def test_importModule(self):
     test_sample2 = util.findObject('goodpackage.test_sample')
     from goodpackage import test_sample
     self.assertEqual((True, test_sample), test_sample2)
Exemplo n.º 20
0
 def test_findNonexistentModule(self):
     self.failUnlessEqual(util.findObject('package.doesntexist')[0], False)