Package twisted :: Package trial :: Module unittest :: Class _Assertions
[show private | hide private]
[frames | no frames]

Type _Assertions

    object --+
             |
object --+   |
         |   |
  TestCase --+
             |
            _Assertions

Known Subclasses:
TestCase

Method Summary
  assert_(self, condition, msg)
fails the test if condition evaluates to True
  assertAlmostEqual(self, first, second, places, msg)
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
  assertAlmostEquals(self, first, second, places, msg)
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
  assertApproximates(self, first, second, tolerance, msg)
asserts that first - second > tolerance
  assertEqual(self, first, second, msg)
fail the test if first and second are not equal
  assertEquals(self, first, second, msg)
fail the test if first and second are not equal
  assertFailure(self, deferred, *expectedFailures)
assert that deferred will errback a failure of type in expectedFailures this is analagous to an async assertRaises
  assertFalse(self, condition, msg)
fails the test if condition evaluates to False
  assertIdentical(self, first, second, msg)
fail the test if first is not second.
  assertIn(self, containee, container, msg)
fail the test if containee is not found in container
  assertNot(self, condition, msg)
fails the test if condition evaluates to False
  assertNotAlmostEqual(self, first, second, places, msg)
Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
  assertNotAlmostEquals(self, first, second, places, msg)
Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
  assertNotEqual(self, first, second, msg)
fail the test if first == second
  assertNotEquals(self, first, second, msg)
fail the test if first == second
  assertNotIdentical(self, first, second, msg)
fail the test if first is second.
  assertNotIn(self, containee, container, msg)
fail the test if containee is found in container
  assertNotSubstring(self, substring, astring, msg)
  assertRaises(self, exception, f, *args, **kwargs)
fails the test unless calling the function f with the given args and kwargs does not raise exception.
  assertSubstring(self, substring, astring, msg)
  assertTrue(self, condition, msg)
fails the test if condition evaluates to True
  fail(self, msg)
absolutely fails the test, do not pass go, do not collect $200
  failIf(self, condition, msg)
fails the test if condition evaluates to False
  failIfAlmostEqual(self, first, second, places, msg)
Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
  failIfAlmostEquals(self, first, second, places, msg)
Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
  failIfEqual(self, first, second, msg)
fail the test if first == second
  failIfEquals(self, first, second, msg)
fail the test if first == second
  failIfIdentical(self, first, second, msg)
fail the test if first is second.
  failIfIn(self, containee, container, msg)
fail the test if containee is found in container
  failIfSubstring(self, substring, astring, msg)
  failUnless(self, condition, msg)
fails the test if condition evaluates to True
  failUnlessAlmostEqual(self, first, second, places, msg)
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
  failUnlessAlmostEquals(self, first, second, places, msg)
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
  failUnlessApproximates(self, first, second, tolerance, msg)
asserts that first - second > tolerance
  failUnlessEqual(self, first, second, msg)
fail the test if first and second are not equal
  failUnlessEquals(self, first, second, msg)
fail the test if first and second are not equal
  failUnlessFailure(self, deferred, *expectedFailures)
assert that deferred will errback a failure of type in expectedFailures this is analagous to an async assertRaises
  failUnlessFalse(self, condition, msg)
fails the test if condition evaluates to False
  failUnlessIdentical(self, first, second, msg)
fail the test if first is not second.
  failUnlessIn(self, containee, container, msg)
fail the test if containee is not found in container
  failUnlessRaises(self, exception, f, *args, **kwargs)
fails the test unless calling the function f with the given args and kwargs does not raise exception.
  failUnlessSubstring(self, substring, astring, msg)
  failUnlessTrue(self, condition, msg)
fails the test if condition evaluates to True
    Inherited from TestCase
  __init__(self, methodName)
Create an instance of the class that will use the named test method when executed.
  __call__(self, *args, **kwds)
  __repr__(self)
  __str__(self)
  countTestCases(self)
  debug(self)
Run the test without collecting errors in a TestResult
  defaultTestResult(self)
  id(self)
  run(self, result)
  setUp(self)
Hook method for setting up the test fixture before exercising it.
  shortDescription(self)
Returns a one-line description of the test, or None if no description has been provided.
  tearDown(self)
Hook method for deconstructing the test fixture after testing it.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Class Variable Summary
Implements __implemented__ = <implementedBy twisted.trial.unittest....
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...
    Inherited from TestCase
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...

Method Details

assert_(self, condition, msg=None)

fails the test if condition evaluates to True
Parameters:
condition - any object that defines __nonzero__
Overrides:
unittest.TestCase.failUnless

assertAlmostEqual(self, first, second, places=7, msg=None)

Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Overrides:
unittest.TestCase.failUnlessAlmostEqual

Notes:

  • decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit).
  • included for compatiblity with PyUnit test cases

assertAlmostEquals(self, first, second, places=7, msg=None)

Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Overrides:
unittest.TestCase.failUnlessAlmostEqual

Notes:

  • decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit).
  • included for compatiblity with PyUnit test cases

assertApproximates(self, first, second, tolerance, msg=None)

asserts that first - second > tolerance
Parameters:
msg - if msg is None, then the failure message will be '%r ~== %r' % (first, second)

assertEqual(self, first, second, msg=None)

fail the test if first and second are not equal
Parameters:
msg - if msg is None, then the failure message will be '%r != %r' % (first, second)
Overrides:
unittest.TestCase.failUnlessEqual

assertEquals(self, first, second, msg=None)

fail the test if first and second are not equal
Parameters:
msg - if msg is None, then the failure message will be '%r != %r' % (first, second)
Overrides:
unittest.TestCase.failUnlessEqual

assertFailure(self, deferred, *expectedFailures)

assert that deferred will errback a failure of type in expectedFailures this is analagous to an async assertRaises

assertFalse(self, condition, msg=None)

fails the test if condition evaluates to False
Parameters:
condition - any object that defines __nonzero__
Overrides:
unittest.TestCase.failIf

assertIdentical(self, first, second, msg=None)

fail the test if first is not second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test
Parameters:
msg - if msg is None, then the failure message will be '%r is not %r' % (first, second)

assertIn(self, containee, container, msg=None)

fail the test if containee is not found in container
Parameters:
containee - the value that should be in container
container - a sequence type, or in the case of a mapping type, will follow semantics of 'if key in dict.keys()'
msg - if msg is None, then the failure message will be '%r not in %r' % (first, second)

assertNot(self, condition, msg=None)

fails the test if condition evaluates to False
Parameters:
condition - any object that defines __nonzero__
Overrides:
unittest.TestCase.failIf

assertNotAlmostEqual(self, first, second, places=7, msg=None)

Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Overrides:
unittest.TestCase.failIfAlmostEqual

Notes:

  • decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit).
  • included for compatiblity with PyUnit test cases

assertNotAlmostEquals(self, first, second, places=7, msg=None)

Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Overrides:
unittest.TestCase.failIfAlmostEqual

Notes:

  • decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit).
  • included for compatiblity with PyUnit test cases

assertNotEqual(self, first, second, msg=None)

fail the test if first == second
Parameters:
msg - if msg is None, then the failure message will be '%r == %r' % (first, second)
Overrides:
unittest.TestCase.failIfEqual

assertNotEquals(self, first, second, msg=None)

fail the test if first == second
Parameters:
msg - if msg is None, then the failure message will be '%r == %r' % (first, second)
Overrides:
unittest.TestCase.failIfEqual

assertNotIdentical(self, first, second, msg=None)

fail the test if first is second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test
Parameters:
msg - if msg is None, then the failure message will be '%r is %r' % (first, second)

assertNotIn(self, containee, container, msg=None)

fail the test if containee is found in container
Parameters:
containee - the value that should not be in container
container - a sequence type, or in the case of a mapping type, will follow semantics of 'if key in dict.keys()'
msg - if msg is None, then the failure message will be '%r in %r' % (first, second)

assertRaises(self, exception, f, *args, **kwargs)

fails the test unless calling the function f with the given args and kwargs does not raise exception. The failure will report the traceback and call stack of the unexpected exception.
Parameters:
exception - exception type that is to be expected
f - the function to call
Returns:
The raised exception instance, if it is of the given type.
Raises:
self.failureException - Raised if the function call does not raise an exception or if it raises an exception of a different type.
Overrides:
unittest.TestCase.failUnlessRaises

assertTrue(self, condition, msg=None)

fails the test if condition evaluates to True
Parameters:
condition - any object that defines __nonzero__
Overrides:
unittest.TestCase.failUnless

fail(self, msg=None)

absolutely fails the test, do not pass go, do not collect $200
Parameters:
msg - the message that will be displayed as the reason for the failure
Overrides:
unittest.TestCase.fail

failIf(self, condition, msg=None)

fails the test if condition evaluates to False
Parameters:
condition - any object that defines __nonzero__
Overrides:
unittest.TestCase.failIf

failIfAlmostEqual(self, first, second, places=7, msg=None)

Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Overrides:
unittest.TestCase.failIfAlmostEqual

Notes:

  • decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit).
  • included for compatiblity with PyUnit test cases

failIfAlmostEquals(self, first, second, places=7, msg=None)

Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Overrides:
unittest.TestCase.failIfAlmostEqual

Notes:

  • decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit).
  • included for compatiblity with PyUnit test cases

failIfEqual(self, first, second, msg=None)

fail the test if first == second
Parameters:
msg - if msg is None, then the failure message will be '%r == %r' % (first, second)
Overrides:
unittest.TestCase.failIfEqual

failIfEquals(self, first, second, msg=None)

fail the test if first == second
Parameters:
msg - if msg is None, then the failure message will be '%r == %r' % (first, second)
Overrides:
unittest.TestCase.failIfEqual

failIfIdentical(self, first, second, msg=None)

fail the test if first is second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test
Parameters:
msg - if msg is None, then the failure message will be '%r is %r' % (first, second)

failIfIn(self, containee, container, msg=None)

fail the test if containee is found in container
Parameters:
containee - the value that should not be in container
container - a sequence type, or in the case of a mapping type, will follow semantics of 'if key in dict.keys()'
msg - if msg is None, then the failure message will be '%r in %r' % (first, second)

failUnless(self, condition, msg=None)

fails the test if condition evaluates to True
Parameters:
condition - any object that defines __nonzero__
Overrides:
unittest.TestCase.failUnless

failUnlessAlmostEqual(self, first, second, places=7, msg=None)

Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Overrides:
unittest.TestCase.failUnlessAlmostEqual

Notes:

  • decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit).
  • included for compatiblity with PyUnit test cases

failUnlessAlmostEquals(self, first, second, places=7, msg=None)

Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Overrides:
unittest.TestCase.failUnlessAlmostEqual

Notes:

  • decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit).
  • included for compatiblity with PyUnit test cases

failUnlessApproximates(self, first, second, tolerance, msg=None)

asserts that first - second > tolerance
Parameters:
msg - if msg is None, then the failure message will be '%r ~== %r' % (first, second)

failUnlessEqual(self, first, second, msg=None)

fail the test if first and second are not equal
Parameters:
msg - if msg is None, then the failure message will be '%r != %r' % (first, second)
Overrides:
unittest.TestCase.failUnlessEqual

failUnlessEquals(self, first, second, msg=None)

fail the test if first and second are not equal
Parameters:
msg - if msg is None, then the failure message will be '%r != %r' % (first, second)
Overrides:
unittest.TestCase.failUnlessEqual

failUnlessFailure(self, deferred, *expectedFailures)

assert that deferred will errback a failure of type in expectedFailures this is analagous to an async assertRaises

failUnlessFalse(self, condition, msg=None)

fails the test if condition evaluates to False
Parameters:
condition - any object that defines __nonzero__
Overrides:
unittest.TestCase.failIf

failUnlessIdentical(self, first, second, msg=None)

fail the test if first is not second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test
Parameters:
msg - if msg is None, then the failure message will be '%r is not %r' % (first, second)

failUnlessIn(self, containee, container, msg=None)

fail the test if containee is not found in container
Parameters:
containee - the value that should be in container
container - a sequence type, or in the case of a mapping type, will follow semantics of 'if key in dict.keys()'
msg - if msg is None, then the failure message will be '%r not in %r' % (first, second)

failUnlessRaises(self, exception, f, *args, **kwargs)

fails the test unless calling the function f with the given args and kwargs does not raise exception. The failure will report the traceback and call stack of the unexpected exception.
Parameters:
exception - exception type that is to be expected
f - the function to call
Returns:
The raised exception instance, if it is of the given type.
Raises:
self.failureException - Raised if the function call does not raise an exception or if it raises an exception of a different type.
Overrides:
unittest.TestCase.failUnlessRaises

failUnlessTrue(self, condition, msg=None)

fails the test if condition evaluates to True
Parameters:
condition - any object that defines __nonzero__
Overrides:
unittest.TestCase.failUnless

Class Variable Details

__implemented__

Type:
Implements
Value:
<implementedBy twisted.trial.unittest._Assertions>                     

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0x4077876c>       

Generated by Epydoc 2.1 on Sat Aug 26 13:54:31 2006 http://epydoc.sf.net