OLD | NEW |
| (Empty) |
1 | |
2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
3 <html><head><title>Python: module telemetry.testing.page_test_test_case</title> | |
4 <meta charset="utf-8"> | |
5 </head><body bgcolor="#f0f0f8"> | |
6 | |
7 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> | |
8 <tr bgcolor="#7799ee"> | |
9 <td valign=bottom> <br> | |
10 <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a hre
f="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry
.testing.html"><font color="#ffffff">testing</font></a>.page_test_test_case</str
ong></big></big></font></td | |
11 ><td align=right valign=bottom | |
12 ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href=
"../telemetry/testing/page_test_test_case.py">telemetry/testing/page_test_test_c
ase.py</a></font></td></tr></table> | |
13 <p><tt>Provide a <a href="unittest.case.html#TestCase">TestCase</a
> base class for PageTest subclasses' unittests.</
tt></p> | |
14 <p> | |
15 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
16 <tr bgcolor="#aa55cc"> | |
17 <td colspan=3 valign=bottom> <br> | |
18 <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big
></font></td></tr> | |
19 | |
20 <tr><td bgcolor="#aa55cc"><tt> </tt></td><td>
</td> | |
21 <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=t
op><a href="telemetry.benchmark.html">telemetry.benchmark</a><br> | |
22 <a href="telemetry.core.exceptions.html">telemetry.core.exceptions</a><br> | |
23 <a href="telemetry.testing.options_for_unittests.html">telemetry.testing.options
_for_unittests</a><br> | |
24 </td><td width="25%" valign=top><a href="telemetry.page.page.html">telemetry.pag
e.page</a><br> | |
25 <a href="telemetry.page.page_test.html">telemetry.page.page_test</a><br> | |
26 <a href="telemetry.internal.results.results_options.html">telemetry.internal.res
ults.results_options</a><br> | |
27 </td><td width="25%" valign=top><a href="telemetry.story.html">telemetry.story</
a><br> | |
28 <a href="telemetry.internal.story_runner.html">telemetry.internal.story_runner</
a><br> | |
29 <a href="unittest.html">unittest</a><br> | |
30 </td><td width="25%" valign=top><a href="telemetry.core.util.html">telemetry.cor
e.util</a><br> | |
31 </td></tr></table></td></tr></table><p> | |
32 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
33 <tr bgcolor="#ee77aa"> | |
34 <td colspan=3 valign=bottom> <br> | |
35 <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big
></font></td></tr> | |
36 | |
37 <tr><td bgcolor="#ee77aa"><tt> </tt></td><td>
</td> | |
38 <td width="100%"><dl> | |
39 <dt><font face="helvetica, arial"><a href="telemetry.benchmark.html#BenchmarkMet
adata">telemetry.benchmark.BenchmarkMetadata</a>(<a href="__builtin__.html#objec
t">__builtin__.object</a>) | |
40 </font></dt><dd> | |
41 <dl> | |
42 <dt><font face="helvetica, arial"><a href="telemetry.testing.page_test_test_case
.html#EmptyMetadataForTest">EmptyMetadataForTest</a> | |
43 </font></dt></dl> | |
44 </dd> | |
45 <dt><font face="helvetica, arial"><a href="telemetry.page.html#Page">telemetry.p
age.Page</a>(<a href="telemetry.story.story.html#Story">telemetry.story.story.St
ory</a>) | |
46 </font></dt><dd> | |
47 <dl> | |
48 <dt><font face="helvetica, arial"><a href="telemetry.testing.page_test_test_case
.html#BasicTestPage">BasicTestPage</a> | |
49 </font></dt></dl> | |
50 </dd> | |
51 <dt><font face="helvetica, arial"><a href="unittest.case.html#TestCase">unittest
.case.TestCase</a>(<a href="__builtin__.html#object">__builtin__.object</a>) | |
52 </font></dt><dd> | |
53 <dl> | |
54 <dt><font face="helvetica, arial"><a href="telemetry.testing.page_test_test_case
.html#PageTestTestCase">PageTestTestCase</a> | |
55 </font></dt></dl> | |
56 </dd> | |
57 </dl> | |
58 <p> | |
59 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
60 <tr bgcolor="#ffc8d8"> | |
61 <td colspan=3 valign=bottom> <br> | |
62 <font color="#000000" face="helvetica, arial"><a name="BasicTestPage">class <str
ong>BasicTestPage</strong></a>(<a href="telemetry.page.html#Page">telemetry.page
.Page</a>)</font></td></tr> | |
63 | |
64 <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> | |
65 <td width="100%"><dl><dt>Method resolution order:</dt> | |
66 <dd><a href="telemetry.testing.page_test_test_case.html#BasicTestPage">BasicTest
Page</a></dd> | |
67 <dd><a href="telemetry.page.html#Page">telemetry.page.Page</a></dd> | |
68 <dd><a href="telemetry.story.story.html#Story">telemetry.story.story.Story</a></
dd> | |
69 <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> | |
70 </dl> | |
71 <hr> | |
72 Methods defined here:<br> | |
73 <dl><dt><a name="BasicTestPage-RunPageInteractions"><strong>RunPageInteractions<
/strong></a>(self, action_runner)</dt></dl> | |
74 | |
75 <dl><dt><a name="BasicTestPage-__init__"><strong>__init__</strong></a>(self, url
, story_set, base_dir)</dt></dl> | |
76 | |
77 <hr> | |
78 Methods inherited from <a href="telemetry.page.html#Page">telemetry.page.Page</a
>:<br> | |
79 <dl><dt><a name="BasicTestPage-AddCustomizeBrowserOptions"><strong>AddCustomizeB
rowserOptions</strong></a>(self, options)</dt><dd><tt>Inherit page ove
rrides this to add customized browser options.</tt
></dd></dl> | |
80 | |
81 <dl><dt><a name="BasicTestPage-AsDict"><strong>AsDict</strong></a>(self)</dt><dd
><tt>Converts a page object to a dict suitabl
e for JSON output.</tt></dd></dl> | |
82 | |
83 <dl><dt><a name="BasicTestPage-GetSyntheticDelayCategories"><strong>GetSynthetic
DelayCategories</strong></a>(self)</dt></dl> | |
84 | |
85 <dl><dt><a name="BasicTestPage-Run"><strong>Run</strong></a>(self, shared_state)
</dt></dl> | |
86 | |
87 <dl><dt><a name="BasicTestPage-RunNavigateSteps"><strong>RunNavigateSteps</stron
g></a>(self, action_runner)</dt></dl> | |
88 | |
89 <dl><dt><a name="BasicTestPage-__cmp__"><strong>__cmp__</strong></a>(self, other
)</dt></dl> | |
90 | |
91 <dl><dt><a name="BasicTestPage-__lt__"><strong>__lt__</strong></a>(self, other)<
/dt></dl> | |
92 | |
93 <dl><dt><a name="BasicTestPage-__str__"><strong>__str__</strong></a>(self)</dt><
/dl> | |
94 | |
95 <hr> | |
96 Data descriptors inherited from <a href="telemetry.page.html#Page">telemetry.pag
e.Page</a>:<br> | |
97 <dl><dt><strong>base_dir</strong></dt> | |
98 </dl> | |
99 <dl><dt><strong>credentials_path</strong></dt> | |
100 </dl> | |
101 <dl><dt><strong>display_name</strong></dt> | |
102 </dl> | |
103 <dl><dt><strong>file_path</strong></dt> | |
104 <dd><tt>Returns the path of the file, stripping&nb
sp;the scheme and query string.</tt></dd> | |
105 </dl> | |
106 <dl><dt><strong>file_path_url</strong></dt> | |
107 <dd><tt>Returns the file path, including the param
s, query, and fragment.</tt></dd> | |
108 </dl> | |
109 <dl><dt><strong>file_path_url_with_scheme</strong></dt> | |
110 </dl> | |
111 <dl><dt><strong>is_file</strong></dt> | |
112 <dd><tt>Returns True iff this URL points to a
file.</tt></dd> | |
113 </dl> | |
114 <dl><dt><strong>page_set</strong></dt> | |
115 </dl> | |
116 <dl><dt><strong>serving_dir</strong></dt> | |
117 </dl> | |
118 <dl><dt><strong>startup_url</strong></dt> | |
119 </dl> | |
120 <dl><dt><strong>story_set</strong></dt> | |
121 </dl> | |
122 <dl><dt><strong>url</strong></dt> | |
123 </dl> | |
124 <hr> | |
125 Data descriptors inherited from <a href="telemetry.story.story.html#Story">telem
etry.story.story.Story</a>:<br> | |
126 <dl><dt><strong>__dict__</strong></dt> | |
127 <dd><tt>dictionary for instance variables (if defined)<
/tt></dd> | |
128 </dl> | |
129 <dl><dt><strong>__weakref__</strong></dt> | |
130 <dd><tt>list of weak references to the object 
;(if defined)</tt></dd> | |
131 </dl> | |
132 <dl><dt><strong>file_safe_name</strong></dt> | |
133 <dd><tt>A version of display_name that's safe to&n
bsp;use as a filename.<br> | |
134 <br> | |
135 The default implementation sanitizes special characters
with underscores,<br> | |
136 but it's okay to override it with a more
specific implementation in<br> | |
137 subclasses.</tt></dd> | |
138 </dl> | |
139 <dl><dt><strong>id</strong></dt> | |
140 </dl> | |
141 <dl><dt><strong>is_local</strong></dt> | |
142 <dd><tt>Returns True iff this story does not
require network.</tt></dd> | |
143 </dl> | |
144 <dl><dt><strong>labels</strong></dt> | |
145 </dl> | |
146 <dl><dt><strong>make_javascript_deterministic</strong></dt> | |
147 </dl> | |
148 <dl><dt><strong>name</strong></dt> | |
149 </dl> | |
150 <dl><dt><strong>shared_state_class</strong></dt> | |
151 </dl> | |
152 </td></tr></table> <p> | |
153 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
154 <tr bgcolor="#ffc8d8"> | |
155 <td colspan=3 valign=bottom> <br> | |
156 <font color="#000000" face="helvetica, arial"><a name="EmptyMetadataForTest">cla
ss <strong>EmptyMetadataForTest</strong></a>(<a href="telemetry.benchmark.html#B
enchmarkMetadata">telemetry.benchmark.BenchmarkMetadata</a>)</font></td></tr> | |
157 | |
158 <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> | |
159 <td width="100%"><dl><dt>Method resolution order:</dt> | |
160 <dd><a href="telemetry.testing.page_test_test_case.html#EmptyMetadataForTest">Em
ptyMetadataForTest</a></dd> | |
161 <dd><a href="telemetry.benchmark.html#BenchmarkMetadata">telemetry.benchmark.Ben
chmarkMetadata</a></dd> | |
162 <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> | |
163 </dl> | |
164 <hr> | |
165 Methods defined here:<br> | |
166 <dl><dt><a name="EmptyMetadataForTest-__init__"><strong>__init__</strong></a>(se
lf)</dt></dl> | |
167 | |
168 <hr> | |
169 Methods inherited from <a href="telemetry.benchmark.html#BenchmarkMetadata">tele
metry.benchmark.BenchmarkMetadata</a>:<br> | |
170 <dl><dt><a name="EmptyMetadataForTest-AsDict"><strong>AsDict</strong></a>(self)<
/dt></dl> | |
171 | |
172 <hr> | |
173 Data descriptors inherited from <a href="telemetry.benchmark.html#BenchmarkMetad
ata">telemetry.benchmark.BenchmarkMetadata</a>:<br> | |
174 <dl><dt><strong>__dict__</strong></dt> | |
175 <dd><tt>dictionary for instance variables (if defined)<
/tt></dd> | |
176 </dl> | |
177 <dl><dt><strong>__weakref__</strong></dt> | |
178 <dd><tt>list of weak references to the object 
;(if defined)</tt></dd> | |
179 </dl> | |
180 <dl><dt><strong>description</strong></dt> | |
181 </dl> | |
182 <dl><dt><strong>name</strong></dt> | |
183 </dl> | |
184 <dl><dt><strong>rerun_options</strong></dt> | |
185 </dl> | |
186 </td></tr></table> <p> | |
187 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
188 <tr bgcolor="#ffc8d8"> | |
189 <td colspan=3 valign=bottom> <br> | |
190 <font color="#000000" face="helvetica, arial"><a name="PageTestTestCase">class <
strong>PageTestTestCase</strong></a>(<a href="unittest.case.html#TestCase">unitt
est.case.TestCase</a>)</font></td></tr> | |
191 | |
192 <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> | |
193 <td colspan=2><tt>A base class to simplify writing 
;unit tests for PageTest subclasses.<br> </tt></td></tr
> | |
194 <tr><td> </td> | |
195 <td width="100%"><dl><dt>Method resolution order:</dt> | |
196 <dd><a href="telemetry.testing.page_test_test_case.html#PageTestTestCase">PageTe
stTestCase</a></dd> | |
197 <dd><a href="unittest.case.html#TestCase">unittest.case.TestCase</a></dd> | |
198 <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> | |
199 </dl> | |
200 <hr> | |
201 Methods defined here:<br> | |
202 <dl><dt><a name="PageTestTestCase-CreateEmptyPageSet"><strong>CreateEmptyPageSet
</strong></a>(self)</dt></dl> | |
203 | |
204 <dl><dt><a name="PageTestTestCase-CreateStorySetFromFileInUnittestDataDir"><stro
ng>CreateStorySetFromFileInUnittestDataDir</strong></a>(self, test_filename)</dt
></dl> | |
205 | |
206 <dl><dt><a name="PageTestTestCase-RunMeasurement"><strong>RunMeasurement</strong
></a>(self, measurement, ps, options<font color="#909090">=None</font>)</dt><dd>
<tt>Runs a measurement against a pageset, returnin
g the rows its outputs.</tt></dd></dl> | |
207 | |
208 <dl><dt><a name="PageTestTestCase-TestTracingCleanedUp"><strong>TestTracingClean
edUp</strong></a>(self, measurement_class, options<font color="#909090">=None</f
ont>)</dt></dl> | |
209 | |
210 <hr> | |
211 Methods inherited from <a href="unittest.case.html#TestCase">unittest.case.TestC
ase</a>:<br> | |
212 <dl><dt><a name="PageTestTestCase-__call__"><strong>__call__</strong></a>(self,
*args, **kwds)</dt></dl> | |
213 | |
214 <dl><dt><a name="PageTestTestCase-__eq__"><strong>__eq__</strong></a>(self, othe
r)</dt></dl> | |
215 | |
216 <dl><dt><a name="PageTestTestCase-__hash__"><strong>__hash__</strong></a>(self)<
/dt></dl> | |
217 | |
218 <dl><dt><a name="PageTestTestCase-__init__"><strong>__init__</strong></a>(self,
methodName<font color="#909090">='runTest'</font>)</dt><dd><tt>Create an&nb
sp;instance of the class that will use the&nb
sp;named test<br> | |
219 method when executed. Raises a ValueError if
the instance does<br> | |
220 not have a method with the specified name.</t
t></dd></dl> | |
221 | |
222 <dl><dt><a name="PageTestTestCase-__ne__"><strong>__ne__</strong></a>(self, othe
r)</dt></dl> | |
223 | |
224 <dl><dt><a name="PageTestTestCase-__repr__"><strong>__repr__</strong></a>(self)<
/dt></dl> | |
225 | |
226 <dl><dt><a name="PageTestTestCase-__str__"><strong>__str__</strong></a>(self)</d
t></dl> | |
227 | |
228 <dl><dt><a name="PageTestTestCase-addCleanup"><strong>addCleanup</strong></a>(se
lf, function, *args, **kwargs)</dt><dd><tt>Add a function, with&n
bsp;arguments, to be called when the test is<
br> | |
229 completed. Functions added are called on a LI
FO basis and are<br> | |
230 called after tearDown on test failure or succ
ess.<br> | |
231 <br> | |
232 Cleanup items are called even if setUp fails&
nbsp;(unlike tearDown).</tt></dd></dl> | |
233 | |
234 <dl><dt><a name="PageTestTestCase-addTypeEqualityFunc"><strong>addTypeEqualityFu
nc</strong></a>(self, typeobj, function)</dt><dd><tt>Add a type s
pecific assertEqual style function to compare a&nb
sp;type.<br> | |
235 <br> | |
236 This method is for use by <a href="unittest.case.h
tml#TestCase">TestCase</a> subclasses that need to regi
ster<br> | |
237 their own type equality functions to provide
nicer error messages.<br> | |
238 <br> | |
239 Args:<br> | |
240 typeobj: The data type to call&
nbsp;this function on when both values<br> | |
241 are 
;of the same type in <a href="#PageTestTestCase-assertE
qual">assertEqual</a>().<br> | |
242 function: The callable taking two&nb
sp;arguments and an optional<br> | |
243 msg=&nbs
p;argument that raises self.<strong>failureException</strong>&nbs
p;with a<br> | |
244 useful&n
bsp;error message when the two arguments are
not equal.</tt></dd></dl> | |
245 | |
246 <dl><dt><a name="PageTestTestCase-assertAlmostEqual"><strong>assertAlmostEqual</
strong></a>(self, first, second, places<font color="#909090">=None</font>, msg<f
ont color="#909090">=None</font>, delta<font color="#909090">=None</font>)</dt><
dd><tt>Fail if the two objects are unequal as
determined by their<br> | |
247 difference rounded to the given number of dec
imal places<br> | |
248 (default 7) and comparing to zero, or by 
;comparing that the<br> | |
249 between the two objects is more than the 
;given delta.<br> | |
250 <br> | |
251 Note that decimal places (from zero) are usua
lly not the same<br> | |
252 as significant digits (measured from the most 
;signficant digit).<br> | |
253 <br> | |
254 If the two objects compare equal then they&nb
sp;will automatically<br> | |
255 compare almost equal.</tt></dd></dl> | |
256 | |
257 <dl><dt><a name="PageTestTestCase-assertAlmostEquals"><strong>assertAlmostEquals
</strong></a> = assertAlmostEqual(self, first, second, places<font color="#90909
0">=None</font>, msg<font color="#909090">=None</font>, delta<font color="#90909
0">=None</font>)</dt><dd><tt>Fail if the two objects ar
e unequal as determined by their<br> | |
258 difference rounded to the given number of dec
imal places<br> | |
259 (default 7) and comparing to zero, or by 
;comparing that the<br> | |
260 between the two objects is more than the 
;given delta.<br> | |
261 <br> | |
262 Note that decimal places (from zero) are usua
lly not the same<br> | |
263 as significant digits (measured from the most 
;signficant digit).<br> | |
264 <br> | |
265 If the two objects compare equal then they&nb
sp;will automatically<br> | |
266 compare almost equal.</tt></dd></dl> | |
267 | |
268 <dl><dt><a name="PageTestTestCase-assertDictContainsSubset"><strong>assertDictCo
ntainsSubset</strong></a>(self, expected, actual, msg<font color="#909090">=None
</font>)</dt><dd><tt>Checks whether actual is a superse
t of expected.</tt></dd></dl> | |
269 | |
270 <dl><dt><a name="PageTestTestCase-assertDictEqual"><strong>assertDictEqual</stro
ng></a>(self, d1, d2, msg<font color="#909090">=None</font>)</dt></dl> | |
271 | |
272 <dl><dt><a name="PageTestTestCase-assertEqual"><strong>assertEqual</strong></a>(
self, first, second, msg<font color="#909090">=None</font>)</dt><dd><tt>Fail&nbs
p;if the two objects are unequal as determine
d by the '=='<br> | |
273 operator.</tt></dd></dl> | |
274 | |
275 <dl><dt><a name="PageTestTestCase-assertEquals"><strong>assertEquals</strong></a
> = assertEqual(self, first, second, msg<font color="#909090">=None</font>)</dt>
<dd><tt>Fail if the two objects are unequal a
s determined by the '=='<br> | |
276 operator.</tt></dd></dl> | |
277 | |
278 <dl><dt><a name="PageTestTestCase-assertFalse"><strong>assertFalse</strong></a>(
self, expr, msg<font color="#909090">=None</font>)</dt><dd><tt>Check that&n
bsp;the expression is false.</tt></dd></dl> | |
279 | |
280 <dl><dt><a name="PageTestTestCase-assertGreater"><strong>assertGreater</strong><
/a>(self, a, b, msg<font color="#909090">=None</font>)</dt><dd><tt>Just lik
e <a href="#PageTestTestCase-assertTrue">assertTrue</a>(a > b)
, but with a nicer default message.</tt></dd></dl> | |
281 | |
282 <dl><dt><a name="PageTestTestCase-assertGreaterEqual"><strong>assertGreaterEqual
</strong></a>(self, a, b, msg<font color="#909090">=None</font>)</dt><dd><tt>Jus
t like <a href="#PageTestTestCase-assertTrue">assertTrue</a>(a &g
t;= b), but with a nicer default message.</tt
></dd></dl> | |
283 | |
284 <dl><dt><a name="PageTestTestCase-assertIn"><strong>assertIn</strong></a>(self,
member, container, msg<font color="#909090">=None</font>)</dt><dd><tt>Just
like <a href="#PageTestTestCase-assertTrue">assertTrue</a>(a in b
), but with a nicer default message.</tt></dd></dl
> | |
285 | |
286 <dl><dt><a name="PageTestTestCase-assertIs"><strong>assertIs</strong></a>(self,
expr1, expr2, msg<font color="#909090">=None</font>)</dt><dd><tt>Just like&
nbsp;<a href="#PageTestTestCase-assertTrue">assertTrue</a>(a is b),&nb
sp;but with a nicer default message.</tt></dd></dl> | |
287 | |
288 <dl><dt><a name="PageTestTestCase-assertIsInstance"><strong>assertIsInstance</st
rong></a>(self, obj, cls, msg<font color="#909090">=None</font>)</dt><dd><tt>Sam
e as <a href="#PageTestTestCase-assertTrue">assertTrue</a>(isinstance(
obj, cls)), with a nicer<br> | |
289 default message.</tt></dd></dl> | |
290 | |
291 <dl><dt><a name="PageTestTestCase-assertIsNone"><strong>assertIsNone</strong></a
>(self, obj, msg<font color="#909090">=None</font>)</dt><dd><tt>Same as&nbs
p;<a href="#PageTestTestCase-assertTrue">assertTrue</a>(obj is None),&
nbsp;with a nicer default message.</tt></dd></dl> | |
292 | |
293 <dl><dt><a name="PageTestTestCase-assertIsNot"><strong>assertIsNot</strong></a>(
self, expr1, expr2, msg<font color="#909090">=None</font>)</dt><dd><tt>Just 
;like <a href="#PageTestTestCase-assertTrue">assertTrue</a>(a is
not b), but with a nicer default message.</tt
></dd></dl> | |
294 | |
295 <dl><dt><a name="PageTestTestCase-assertIsNotNone"><strong>assertIsNotNone</stro
ng></a>(self, obj, msg<font color="#909090">=None</font>)</dt><dd><tt>Included&n
bsp;for symmetry with assertIsNone.</tt></dd></dl> | |
296 | |
297 <dl><dt><a name="PageTestTestCase-assertItemsEqual"><strong>assertItemsEqual</st
rong></a>(self, expected_seq, actual_seq, msg<font color="#909090">=None</font>)
</dt><dd><tt>An unordered sequence specific comparison. 
;It asserts that<br> | |
298 actual_seq and expected_seq have the same element&
nbsp;counts.<br> | |
299 Equivalent to::<br> | |
300 <br> | |
301 <a href="#PageTestTestCase-assertEqual">assertEqual</a>(
Counter(iter(actual_seq)),<br> | |
302 &n
bsp; Counter(iter(expected_seq)))<br> | |
303 <br> | |
304 Asserts that each element has the same count&
nbsp;in both sequences.<br> | |
305 Example:<br> | |
306 - [0, 1, 1] and [1, 0,&nbs
p;1] compare equal.<br> | |
307 - [0, 0, 1] and [0, 1]&nbs
p;compare unequal.</tt></dd></dl> | |
308 | |
309 <dl><dt><a name="PageTestTestCase-assertLess"><strong>assertLess</strong></a>(se
lf, a, b, msg<font color="#909090">=None</font>)</dt><dd><tt>Just like 
;<a href="#PageTestTestCase-assertTrue">assertTrue</a>(a < b), 
;but with a nicer default message.</tt></dd></dl> | |
310 | |
311 <dl><dt><a name="PageTestTestCase-assertLessEqual"><strong>assertLessEqual</stro
ng></a>(self, a, b, msg<font color="#909090">=None</font>)</dt><dd><tt>Just 
;like <a href="#PageTestTestCase-assertTrue">assertTrue</a>(a <=&nb
sp;b), but with a nicer default message.</tt></dd>
</dl> | |
312 | |
313 <dl><dt><a name="PageTestTestCase-assertListEqual"><strong>assertListEqual</stro
ng></a>(self, list1, list2, msg<font color="#909090">=None</font>)</dt><dd><tt>A
list-specific equality assertion.<br> | |
314 <br> | |
315 Args:<br> | |
316 list1: The first list to compar
e.<br> | |
317 list2: The second list to compa
re.<br> | |
318 msg: Optional message to use on
failure instead of a list of<br> | |
319 differen
ces.</tt></dd></dl> | |
320 | |
321 <dl><dt><a name="PageTestTestCase-assertMultiLineEqual"><strong>assertMultiLineE
qual</strong></a>(self, first, second, msg<font color="#909090">=None</font>)</d
t><dd><tt>Assert that two multi-line strings are e
qual.</tt></dd></dl> | |
322 | |
323 <dl><dt><a name="PageTestTestCase-assertNotAlmostEqual"><strong>assertNotAlmostE
qual</strong></a>(self, first, second, places<font color="#909090">=None</font>,
msg<font color="#909090">=None</font>, delta<font color="#909090">=None</font>)
</dt><dd><tt>Fail if the two objects are equal&nbs
p;as determined by their<br> | |
324 difference rounded to the given number of dec
imal places<br> | |
325 (default 7) and comparing to zero, or by 
;comparing that the<br> | |
326 between the two objects is less than the 
;given delta.<br> | |
327 <br> | |
328 Note that decimal places (from zero) are usua
lly not the same<br> | |
329 as significant digits (measured from the most 
;signficant digit).<br> | |
330 <br> | |
331 Objects that are equal automatically fail.</tt></dd></d
l> | |
332 | |
333 <dl><dt><a name="PageTestTestCase-assertNotAlmostEquals"><strong>assertNotAlmost
Equals</strong></a> = assertNotAlmostEqual(self, first, second, places<font colo
r="#909090">=None</font>, msg<font color="#909090">=None</font>, delta<font colo
r="#909090">=None</font>)</dt><dd><tt>Fail if the two object
s are equal as determined by their<br> | |
334 difference rounded to the given number of dec
imal places<br> | |
335 (default 7) and comparing to zero, or by 
;comparing that the<br> | |
336 between the two objects is less than the 
;given delta.<br> | |
337 <br> | |
338 Note that decimal places (from zero) are usua
lly not the same<br> | |
339 as significant digits (measured from the most 
;signficant digit).<br> | |
340 <br> | |
341 Objects that are equal automatically fail.</tt></dd></d
l> | |
342 | |
343 <dl><dt><a name="PageTestTestCase-assertNotEqual"><strong>assertNotEqual</strong
></a>(self, first, second, msg<font color="#909090">=None</font>)</dt><dd><tt>Fa
il if the two objects are equal as deter
mined by the '!='<br> | |
344 operator.</tt></dd></dl> | |
345 | |
346 <dl><dt><a name="PageTestTestCase-assertNotEquals"><strong>assertNotEquals</stro
ng></a> = assertNotEqual(self, first, second, msg<font color="#909090">=None</fo
nt>)</dt><dd><tt>Fail if the two objects are equal
as determined by the '!='<br> | |
347 operator.</tt></dd></dl> | |
348 | |
349 <dl><dt><a name="PageTestTestCase-assertNotIn"><strong>assertNotIn</strong></a>(
self, member, container, msg<font color="#909090">=None</font>)</dt><dd><tt>Just
like <a href="#PageTestTestCase-assertTrue">assertTrue</a>(a not
in b), but with a nicer default message
.</tt></dd></dl> | |
350 | |
351 <dl><dt><a name="PageTestTestCase-assertNotIsInstance"><strong>assertNotIsInstan
ce</strong></a>(self, obj, cls, msg<font color="#909090">=None</font>)</dt><dd><
tt>Included for symmetry with assertIsInstance.</tt></dd></d
l> | |
352 | |
353 <dl><dt><a name="PageTestTestCase-assertNotRegexpMatches"><strong>assertNotRegex
pMatches</strong></a>(self, text, unexpected_regexp, msg<font color="#909090">=N
one</font>)</dt><dd><tt>Fail the test if the text
matches the regular expression.</tt></dd></dl> | |
354 | |
355 <dl><dt><a name="PageTestTestCase-assertRaises"><strong>assertRaises</strong></a
>(self, excClass, callableObj<font color="#909090">=None</font>, *args, **kwargs
)</dt><dd><tt>Fail unless an exception of class ex
cClass is raised<br> | |
356 by callableObj when invoked with arguments args&nb
sp;and keyword<br> | |
357 arguments kwargs. If a different type of exce
ption is<br> | |
358 raised, it will not be caught, and the t
est case will be<br> | |
359 deemed to have suffered an error, exactly as&
nbsp;for an<br> | |
360 unexpected exception.<br> | |
361 <br> | |
362 If called with callableObj omitted or None, w
ill return a<br> | |
363 context object used like this::<br> | |
364 <br> | |
365 with <a href="#PageTestTestCase-assertRaises"
>assertRaises</a>(SomeException):<br> | |
366 do_something()<br> | |
367 <br> | |
368 The context manager keeps a reference to the&
nbsp;exception as<br> | |
369 the 'exception' attribute. This allows you to 
;inspect the<br> | |
370 exception after the assertion::<br> | |
371 <br> | |
372 with <a href="#PageTestTestCase-assertRaises">asser
tRaises</a>(SomeException) as cm:<br> | |
373 do_something()<br> | |
374 the_exception = cm.exception<br> | |
375 <a href="#PageTestTestCase-assertEqual">assertEqual</a>(
the_exception.error_code, 3)</tt></dd></dl> | |
376 | |
377 <dl><dt><a name="PageTestTestCase-assertRaisesRegexp"><strong>assertRaisesRegexp
</strong></a>(self, expected_exception, expected_regexp, callable_obj<font color
="#909090">=None</font>, *args, **kwargs)</dt><dd><tt>Asserts that the
message in a raised exception matches a 
;regexp.<br> | |
378 <br> | |
379 Args:<br> | |
380 expected_exception: Exception class expec
ted to be raised.<br> | |
381 expected_regexp: Regexp (re pattern
object or string) expected<br> | |
382 to
be found in error message.<br> | |
383 callable_obj: Function to be called.
<br> | |
384 args: Extra args.<br> | |
385 kwargs: Extra kwargs.</tt></dd></dl> | |
386 | |
387 <dl><dt><a name="PageTestTestCase-assertRegexpMatches"><strong>assertRegexpMatch
es</strong></a>(self, text, expected_regexp, msg<font color="#909090">=None</fon
t>)</dt><dd><tt>Fail the test unless the text matc
hes the regular expression.</tt></dd></dl> | |
388 | |
389 <dl><dt><a name="PageTestTestCase-assertSequenceEqual"><strong>assertSequenceEqu
al</strong></a>(self, seq1, seq2, msg<font color="#909090">=None</font>, seq_typ
e<font color="#909090">=None</font>)</dt><dd><tt>An equality assertion
for ordered sequences (like lists and tuples
).<br> | |
390 <br> | |
391 For the purposes of this function, a valid&nb
sp;ordered sequence type is one<br> | |
392 which can be indexed, has a length, and
has an equality operator.<br> | |
393 <br> | |
394 Args:<br> | |
395 seq1: The first sequence to com
pare.<br> | |
396 seq2: The second sequence to co
mpare.<br> | |
397 seq_type: The expected datatype of&n
bsp;the sequences, or None if no<br> | |
398 datatype
should be enforced.<br> | |
399 msg: Optional message to use on
failure instead of a list of<br> | |
400 differen
ces.</tt></dd></dl> | |
401 | |
402 <dl><dt><a name="PageTestTestCase-assertSetEqual"><strong>assertSetEqual</strong
></a>(self, set1, set2, msg<font color="#909090">=None</font>)</dt><dd><tt>A&nbs
p;set-specific equality assertion.<br> | |
403 <br> | |
404 Args:<br> | |
405 set1: The first set to compare.
<br> | |
406 set2: The second set to compare
.<br> | |
407 msg: Optional message to use on
failure instead of a list of<br> | |
408 differen
ces.<br> | |
409 <br> | |
410 assertSetEqual uses ducktyping to support different&nbs
p;types of sets, and<br> | |
411 is optimized for sets specifically (parameters mus
t support a<br> | |
412 difference method).</tt></dd></dl> | |
413 | |
414 <dl><dt><a name="PageTestTestCase-assertTrue"><strong>assertTrue</strong></a>(se
lf, expr, msg<font color="#909090">=None</font>)</dt><dd><tt>Check that&nbs
p;the expression is true.</tt></dd></dl> | |
415 | |
416 <dl><dt><a name="PageTestTestCase-assertTupleEqual"><strong>assertTupleEqual</st
rong></a>(self, tuple1, tuple2, msg<font color="#909090">=None</font>)</dt><dd><
tt>A tuple-specific equality assertion.<br> | |
417 <br> | |
418 Args:<br> | |
419 tuple1: The first tuple to comp
are.<br> | |
420 tuple2: The second tuple to com
pare.<br> | |
421 msg: Optional message to use on
failure instead of a list of<br> | |
422 differen
ces.</tt></dd></dl> | |
423 | |
424 <dl><dt><a name="PageTestTestCase-assert_"><strong>assert_</strong></a> = assert
True(self, expr, msg<font color="#909090">=None</font>)</dt><dd><tt>Check t
hat the expression is true.</tt></dd></dl> | |
425 | |
426 <dl><dt><a name="PageTestTestCase-countTestCases"><strong>countTestCases</strong
></a>(self)</dt></dl> | |
427 | |
428 <dl><dt><a name="PageTestTestCase-debug"><strong>debug</strong></a>(self)</dt><d
d><tt>Run the test without collecting errors in&nb
sp;a TestResult</tt></dd></dl> | |
429 | |
430 <dl><dt><a name="PageTestTestCase-defaultTestResult"><strong>defaultTestResult</
strong></a>(self)</dt></dl> | |
431 | |
432 <dl><dt><a name="PageTestTestCase-doCleanups"><strong>doCleanups</strong></a>(se
lf)</dt><dd><tt>Execute all cleanup functions. Normally 
;called for you after<br> | |
433 tearDown.</tt></dd></dl> | |
434 | |
435 <dl><dt><a name="PageTestTestCase-fail"><strong>fail</strong></a>(self, msg<font
color="#909090">=None</font>)</dt><dd><tt>Fail immediately, with 
;the given message.</tt></dd></dl> | |
436 | |
437 <dl><dt><a name="PageTestTestCase-failIf"><strong>failIf</strong></a> = deprecat
ed_func(*args, **kwargs)</dt></dl> | |
438 | |
439 <dl><dt><a name="PageTestTestCase-failIfAlmostEqual"><strong>failIfAlmostEqual</
strong></a> = deprecated_func(*args, **kwargs)</dt></dl> | |
440 | |
441 <dl><dt><a name="PageTestTestCase-failIfEqual"><strong>failIfEqual</strong></a>
= deprecated_func(*args, **kwargs)</dt></dl> | |
442 | |
443 <dl><dt><a name="PageTestTestCase-failUnless"><strong>failUnless</strong></a> =
deprecated_func(*args, **kwargs)</dt></dl> | |
444 | |
445 <dl><dt><a name="PageTestTestCase-failUnlessAlmostEqual"><strong>failUnlessAlmos
tEqual</strong></a> = deprecated_func(*args, **kwargs)</dt></dl> | |
446 | |
447 <dl><dt><a name="PageTestTestCase-failUnlessEqual"><strong>failUnlessEqual</stro
ng></a> = deprecated_func(*args, **kwargs)</dt></dl> | |
448 | |
449 <dl><dt><a name="PageTestTestCase-failUnlessRaises"><strong>failUnlessRaises</st
rong></a> = deprecated_func(*args, **kwargs)</dt></dl> | |
450 | |
451 <dl><dt><a name="PageTestTestCase-id"><strong>id</strong></a>(self)</dt></dl> | |
452 | |
453 <dl><dt><a name="PageTestTestCase-run"><strong>run</strong></a>(self, result<fon
t color="#909090">=None</font>)</dt></dl> | |
454 | |
455 <dl><dt><a name="PageTestTestCase-setUp"><strong>setUp</strong></a>(self)</dt><d
d><tt>Hook method for setting up the test fix
ture before exercising it.</tt></dd></dl> | |
456 | |
457 <dl><dt><a name="PageTestTestCase-shortDescription"><strong>shortDescription</st
rong></a>(self)</dt><dd><tt>Returns a one-line description o
f the test, or None if no<br> | |
458 description has been provided.<br> | |
459 <br> | |
460 The default implementation of this method returns&
nbsp;the first line of<br> | |
461 the specified test method's docstring.</tt></dd></dl> | |
462 | |
463 <dl><dt><a name="PageTestTestCase-skipTest"><strong>skipTest</strong></a>(self,
reason)</dt><dd><tt>Skip this test.</tt></dd></dl> | |
464 | |
465 <dl><dt><a name="PageTestTestCase-tearDown"><strong>tearDown</strong></a>(self)<
/dt><dd><tt>Hook method for deconstructing the test&nbs
p;fixture after testing it.</tt></dd></dl> | |
466 | |
467 <hr> | |
468 Class methods inherited from <a href="unittest.case.html#TestCase">unittest.case
.TestCase</a>:<br> | |
469 <dl><dt><a name="PageTestTestCase-setUpClass"><strong>setUpClass</strong></a>(cl
s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__
.html#type">__builtin__.type</a></font></font></dt><dd><tt>Hook method 
;for setting up class fixture before running
tests in the class.</tt></dd></dl> | |
470 | |
471 <dl><dt><a name="PageTestTestCase-tearDownClass"><strong>tearDownClass</strong><
/a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="__bui
ltin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Hook metho
d for deconstructing the class fixture after
running all tests in the class.</tt></dd></dl> | |
472 | |
473 <hr> | |
474 Data descriptors inherited from <a href="unittest.case.html#TestCase">unittest.c
ase.TestCase</a>:<br> | |
475 <dl><dt><strong>__dict__</strong></dt> | |
476 <dd><tt>dictionary for instance variables (if defined)<
/tt></dd> | |
477 </dl> | |
478 <dl><dt><strong>__weakref__</strong></dt> | |
479 <dd><tt>list of weak references to the object 
;(if defined)</tt></dd> | |
480 </dl> | |
481 <hr> | |
482 Data and other attributes inherited from <a href="unittest.case.html#TestCase">u
nittest.case.TestCase</a>:<br> | |
483 <dl><dt><strong>failureException</strong> = <type 'exceptions.AssertionError'
><dd><tt>Assertion failed.</tt></dl> | |
484 | |
485 <dl><dt><strong>longMessage</strong> = False</dl> | |
486 | |
487 <dl><dt><strong>maxDiff</strong> = 640</dl> | |
488 | |
489 </td></tr></table></td></tr></table> | |
490 </body></html> | |
OLD | NEW |