Example #1
0
 def test_onlyObject(self):
     """
     L{prefixedMethods} returns a list of the methods discovered on an
     object.
     """
     x = Base()
     output = prefixedMethods(x)
     self.assertEqual([x.method], output)
Example #2
0
 def test_prefix(self):
     """
     If a prefix is given, L{prefixedMethods} returns only methods named
     with that prefix.
     """
     x = Separate()
     output = prefixedMethods(x, 'good_')
     self.assertEqual([x.good_method], output)
Example #3
0
 def test_prefix(self):
     """
     If a prefix is given, L{prefixedMethods} returns only methods named
     with that prefix.
     """
     x = Separate()
     output = prefixedMethods(x, 'good_')
     self.assertEqual([x.good_method], output)
Example #4
0
 def test_onlyObject(self):
     """
     L{prefixedMethods} returns a list of the methods discovered on an
     object.
     """
     x = Base()
     output = prefixedMethods(x)
     self.assertEqual([x.method], output)
Example #5
0
 def test_failUnlessMatchesAssert(self):
     """
     The C{failUnless*} test methods are a subset of the C{assert*} test
     methods.  This is intended to ensure that methods using the
     I{failUnless} naming scheme are not added without corresponding methods
     using the I{assert} naming scheme.  The I{assert} naming scheme is
     preferred, and new I{assert}-prefixed methods may be added without
     corresponding I{failUnless}-prefixed methods.
     """
     asserts = set(self._getAsserts())
     failUnlesses = set(prefixedMethods(self, 'failUnless'))
     self.assertEqual(failUnlesses, asserts.intersection(failUnlesses))
 def test_failUnlessMatchesAssert(self):
     """
     The C{failUnless*} test methods are a subset of the C{assert*} test
     methods.  This is intended to ensure that methods using the
     I{failUnless} naming scheme are not added without corresponding methods
     using the I{assert} naming scheme.  The I{assert} naming scheme is
     preferred, and new I{assert}-prefixed methods may be added without
     corresponding I{failUnless}-prefixed methods.
     """
     asserts = set(self._getAsserts())
     failUnlesses = set(prefixedMethods(self, "failUnless"))
     self.assertEqual(failUnlesses, asserts.intersection(failUnlesses))
Example #7
0
 def test_failIf_matches_assertNot(self):
     asserts = prefixedMethods(unittest.SynchronousTestCase, 'assertNot')
     failIfs = prefixedMethods(unittest.SynchronousTestCase, 'failIf')
     self.assertEqual(sorted(asserts, key=self._name),
                          sorted(failIfs, key=self._name))
Example #8
0
 def test_failIf_matches_assertNot(self):
     asserts = prefixedMethods(unittest.SynchronousTestCase, 'assertNot')
     failIfs = prefixedMethods(unittest.SynchronousTestCase, 'failIf')
     self.assertEqual(sorted(asserts, key=self._name),
                      sorted(failIfs, key=self._name))