Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « numpy.testing »

Classe « TestCase »

Informations générales

Héritage

builtins.object
    TestCase

Définition

class TestCase(builtins.object):

Description [extrait de TestCase.__doc__]

A class whose instances are single test cases.

    By default, the test code itself should be placed in a method named
    'runTest'.

    If the fixture may be used for many test cases, create as
    many test methods as are needed. When instantiating such a TestCase
    subclass, specify in the constructor arguments the name of the test method
    that the instance is to execute.

    Test authors should subclass TestCase for their own tests. Construction
    and deconstruction of the test's environment ('fixture') can be
    implemented by overriding the 'setUp' and 'tearDown' methods respectively.

    If it is necessary to override the __init__ method, the base class
    __init__ method must always be called. It is important that subclasses
    should not change the signature of their __init__ method, since instances
    of the classes are instantiated automatically by parts of the framework
    in order to be run.

    When subclassing TestCase, you can set these attributes:
    * failureException: determines which exception will be raised when
        the instance's assertion methods fail; test methods raising this
        exception will be deemed to have 'failed' rather than 'errored'.
    * longMessage: determines whether long messages (including repr of
        objects used in assert methods) will be printed on failure in *addition*
        to any explicit message passed.
    * maxDiff: sets the maximum length of a diff in failure messages
        by assert methods using difflib. It is looked up as an instance
        attribute so can be configured by individual tests if required.
    

Constructeur(s)

Signature du constructeur Description
__init__(self, methodName='runTest') Create an instance of the class that will use the named test [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
longMessageTrue
maxDiff640

Liste des opérateurs

Signature de l'opérateur Description
__eq__(self, other)

Opérateurs hérités de la classe object

__ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__call__(self, *args, **kwds)
__hash__(self)
__repr__(self)
__str__(self)
addClassCleanup(function, /, *args, **kwargs) Same as addCleanup, except the cleanup items are called even if [extrait de addClassCleanup.__doc__]
addCleanup(self, function, /, *args, **kwargs) Add a function, with arguments, to be called when the test is [extrait de addCleanup.__doc__]
addTypeEqualityFunc(self, typeobj, function) Add a type specific assertEqual style function to compare a type. [extrait de addTypeEqualityFunc.__doc__]
assert_(*args, **kwargs)
assertAlmostEqual(self, first, second, places=None, msg=None, delta=None) Fail if the two objects are unequal as determined by their [extrait de assertAlmostEqual.__doc__]
assertAlmostEquals(*args, **kwargs)
assertCountEqual(self, first, second, msg=None) Asserts that two iterables have the same elements, the same number of [extrait de assertCountEqual.__doc__]
assertDictContainsSubset(self, subset, dictionary, msg=None) Checks whether dictionary is a superset of subset. [extrait de assertDictContainsSubset.__doc__]
assertDictEqual(self, d1, d2, msg=None)
assertEqual(self, first, second, msg=None) Fail if the two objects are unequal as determined by the '==' [extrait de assertEqual.__doc__]
assertEquals(*args, **kwargs)
assertFalse(self, expr, msg=None) Check that the expression is false. [extrait de assertFalse.__doc__]
assertGreater(self, a, b, msg=None) Just like self.assertTrue(a > b), but with a nicer default message. [extrait de assertGreater.__doc__]
assertGreaterEqual(self, a, b, msg=None) Just like self.assertTrue(a >= b), but with a nicer default message. [extrait de assertGreaterEqual.__doc__]
assertIn(self, member, container, msg=None) Just like self.assertTrue(a in b), but with a nicer default message. [extrait de assertIn.__doc__]
assertIs(self, expr1, expr2, msg=None) Just like self.assertTrue(a is b), but with a nicer default message. [extrait de assertIs.__doc__]
assertIsInstance(self, obj, cls, msg=None) Same as self.assertTrue(isinstance(obj, cls)), with a nicer [extrait de assertIsInstance.__doc__]
assertIsNone(self, obj, msg=None) Same as self.assertTrue(obj is None), with a nicer default message. [extrait de assertIsNone.__doc__]
assertIsNot(self, expr1, expr2, msg=None) Just like self.assertTrue(a is not b), but with a nicer default message. [extrait de assertIsNot.__doc__]
assertIsNotNone(self, obj, msg=None) Included for symmetry with assertIsNone. [extrait de assertIsNotNone.__doc__]
assertLess(self, a, b, msg=None) Just like self.assertTrue(a < b), but with a nicer default message. [extrait de assertLess.__doc__]
assertLessEqual(self, a, b, msg=None) Just like self.assertTrue(a <= b), but with a nicer default message. [extrait de assertLessEqual.__doc__]
assertListEqual(self, list1, list2, msg=None) A list-specific equality assertion. [extrait de assertListEqual.__doc__]
assertLogs(self, logger=None, level=None) Fail unless a log message of level *level* or higher is emitted [extrait de assertLogs.__doc__]
assertMultiLineEqual(self, first, second, msg=None) Assert that two multi-line strings are equal. [extrait de assertMultiLineEqual.__doc__]
assertNotAlmostEqual(self, first, second, places=None, msg=None, delta=None) Fail if the two objects are equal as determined by their [extrait de assertNotAlmostEqual.__doc__]
assertNotAlmostEquals(*args, **kwargs)
assertNotEqual(self, first, second, msg=None) Fail if the two objects are equal as determined by the '!=' [extrait de assertNotEqual.__doc__]
assertNotEquals(*args, **kwargs)
assertNotIn(self, member, container, msg=None) Just like self.assertTrue(a not in b), but with a nicer default message. [extrait de assertNotIn.__doc__]
assertNotIsInstance(self, obj, cls, msg=None) Included for symmetry with assertIsInstance. [extrait de assertNotIsInstance.__doc__]
assertNotRegex(self, text, unexpected_regex, msg=None) Fail the test if the text matches the regular expression. [extrait de assertNotRegex.__doc__]
assertNotRegexpMatches(*args, **kwargs)
assertRaises(self, expected_exception, *args, **kwargs) Fail unless an exception of class expected_exception is raised [extrait de assertRaises.__doc__]
assertRaisesRegex(self, expected_exception, expected_regex, *args, **kwargs) Asserts that the message in a raised exception matches a regex. [extrait de assertRaisesRegex.__doc__]
assertRaisesRegexp(*args, **kwargs)
assertRegex(self, text, expected_regex, msg=None) Fail the test unless the text matches the regular expression. [extrait de assertRegex.__doc__]
assertRegexpMatches(*args, **kwargs)
assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None) An equality assertion for ordered sequences (like lists and tuples). [extrait de assertSequenceEqual.__doc__]
assertSetEqual(self, set1, set2, msg=None) A set-specific equality assertion. [extrait de assertSetEqual.__doc__]
assertTrue(self, expr, msg=None) Check that the expression is true. [extrait de assertTrue.__doc__]
assertTupleEqual(self, tuple1, tuple2, msg=None) A tuple-specific equality assertion. [extrait de assertTupleEqual.__doc__]
assertWarns(self, expected_warning, *args, **kwargs) Fail unless a warning of class warnClass is triggered [extrait de assertWarns.__doc__]
assertWarnsRegex(self, expected_warning, expected_regex, *args, **kwargs) Asserts that the message in a triggered warning matches a regexp. [extrait de assertWarnsRegex.__doc__]
countTestCases(self)
debug(self) Run the test without collecting errors in a TestResult [extrait de debug.__doc__]
defaultTestResult(self)
doClassCleanups() Execute all class cleanup functions. Normally called for you after [extrait de doClassCleanups.__doc__]
doCleanups(self) Execute all cleanup functions. Normally called for you after [extrait de doCleanups.__doc__]
fail(self, msg=None) Fail immediately, with the given message. [extrait de fail.__doc__]
failIf(*args, **kwargs)
failIfAlmostEqual(*args, **kwargs)
failIfEqual(*args, **kwargs)
failUnless(*args, **kwargs)
failUnlessAlmostEqual(*args, **kwargs)
failUnlessEqual(*args, **kwargs)
failUnlessRaises(*args, **kwargs)
id(self)
run(self, result=None)
setUp(self) Hook method for setting up the test fixture before exercising it. [extrait de setUp.__doc__]
setUpClass() Hook method for setting up class fixture before running tests in the class. [extrait de setUpClass.__doc__]
shortDescription(self) Returns a one-line description of the test, or None if no [extrait de shortDescription.__doc__]
skipTest(self, reason) Skip this test. [extrait de skipTest.__doc__]
subTest(self, msg=<object object at 0x7f508b9b2030>, **params) Return a context manager that will return the enclosed block [extrait de subTest.__doc__]
tearDown(self) Hook method for deconstructing the test fixture after testing it. [extrait de tearDown.__doc__]
tearDownClass() Hook method for deconstructing the class fixture after running all tests in the class. [extrait de tearDownClass.__doc__]

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __init_subclass__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__