unittest.case.TestCase
"""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.
如果夹具可能用于许多测试案例,请根据需要创建尽可能多的测试方法。
在实例化这样一个TestCase子类时,在构造函数参数中指定该实例要执行的测试方法的名称。
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.
测试作者应该继承TestCase的自己的测试。 测试环境('fixture')的构建和解构
可以通过分别重写'setUp'和'tearDown'方法来实现。
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.
如果有必要重写__init__方法,则必须始终调用基类__init__方法。 子类不应该
改变__init__方法的签名,因为这些类的实例会被框架的某些部分自动实例化以便运行。
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'.
* failureException:确定当实例的断言方法失败时会引发哪个异常; 引发此异常的测
试方法将被视为“失败”而非“错误”。
* 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.
* longMessage:确定长消息(包括assert方法中使用的对象的repr)是否会在* addition *中
的任何显式消息传递失败时被打印。
* 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.
"""
maxDiff:通过使用difflib声明方法来设置失败消息中diff的最大长度。 它被查找为实例属性,
因此可以根据需要通过单个测试进行配置。
浙公网安备 33010602011771号