forked from WING-NUS/RSScrawler-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testcase-doc.txt
384 lines (378 loc) · 15.8 KB
/
testcase-doc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
Help on module testcase:
NAME
testcase
FILE
c:\users\fangning\desktop\rssarchive\test2\testcase.py
CLASSES
unittest.case.TestCase(__builtin__.object)
TestRSSCrawlerFunctions
class TestRSSCrawlerFunctions(unittest.case.TestCase)
| Method resolution order:
| TestRSSCrawlerFunctions
| unittest.case.TestCase
| __builtin__.object
|
| Methods defined here:
|
| setUp(self)
| # initiate an object for testing
|
| test_calWordsFrequency(self)
| # test the function of counting words frequency with a simple string, that is, "test crawler code code"
|
| test_createAllFetchedLinks(self)
| # test to create a database , that is, fetchedlinks.db
|
| test_fetchNews(self)
| # test to fetch a real RSS source ,that is, 'http://feeds.foxnews.com/foxnews/entertainment' .
|
| test_fetchWebpage_URL(self)
| # test download a whole webpage function with a correct link
|
| test_fetchWebpage_wrongURL(self)
| # test download a whole webpage function with a wrong link
|
| test_fetchXML_URL(self)
| # test a correct inputting URL source
|
| test_fetchXML_wrongURL(self)
| # test a wrong inputting URL source
|
| test_loadWordsFrequency(self)
| # test the function of downlaoding words frequency record from a database, that is, RSSName.db
|
| test_specialProcessing(self)
| # test special processing for special websites, such as, NewYork Times and Straits Times
|
| test_storeNewLinkInMERGEandHTML(self)
| # test to store fetched wenpage into a html file and update a record file, that is, MERGE.TXT
|
| test_updateNewLinks(self)
| # test the function of update recorded database , that is, fetchedlinks.db , in terms of the fetched webpages .
|
| ----------------------------------------------------------------------
| Methods inherited from unittest.case.TestCase:
|
| __call__(self, *args, **kwds)
|
| __eq__(self, other)
|
| __hash__(self)
|
| __init__(self, methodName='runTest')
| Create an instance of the class that will use the named test
| method when executed. Raises a ValueError if the instance does
| not have a method with the specified name.
|
| __ne__(self, other)
|
| __repr__(self)
|
| __str__(self)
|
| addCleanup(self, function, *args, **kwargs)
| Add a function, with arguments, to be called when the test is
| completed. Functions added are called on a LIFO basis and are
| called after tearDown on test failure or success.
|
| Cleanup items are called even if setUp fails (unlike tearDown).
|
| addTypeEqualityFunc(self, typeobj, function)
| Add a type specific assertEqual style function to compare a type.
|
| This method is for use by TestCase subclasses that need to register
| their own type equality functions to provide nicer error messages.
|
| Args:
| typeobj: The data type to call this function on when both values
| are of the same type in assertEqual().
| function: The callable taking two arguments and an optional
| msg= argument that raises self.failureException with a
| useful error message when the two arguments are not equal.
|
| assertAlmostEqual(self, first, second, places=None, msg=None, delta=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, or by comparing that the
| between the two objects is more than the given delta.
|
| Note that decimal places (from zero) are usually not the same
| as significant digits (measured from the most signficant digit).
|
| If the two objects compare equal then they will automatically
| compare almost equal.
|
| assertAlmostEquals = assertAlmostEqual(self, first, second, places=None, msg=None, delta=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, or by comparing that the
| between the two objects is more than the given delta.
|
| Note that decimal places (from zero) are usually not the same
| as significant digits (measured from the most signficant digit).
|
| If the two objects compare equal then they will automatically
| compare almost equal.
|
| assertDictContainsSubset(self, expected, actual, msg=None)
| Checks whether actual is a superset of expected.
|
| assertDictEqual(self, d1, d2, msg=None)
|
| assertEqual(self, first, second, msg=None)
| Fail if the two objects are unequal as determined by the '=='
| operator.
|
| assertEquals = assertEqual(self, first, second, msg=None)
| Fail if the two objects are unequal as determined by the '=='
| operator.
|
| assertFalse(self, expr, msg=None)
| Check that the expression is false.
|
| assertGreater(self, a, b, msg=None)
| Just like self.assertTrue(a > b), but with a nicer default message.
|
| assertGreaterEqual(self, a, b, msg=None)
| Just like self.assertTrue(a >= b), but with a nicer default message.
|
| assertIn(self, member, container, msg=None)
| Just like self.assertTrue(a in b), but with a nicer default message.
|
| assertIs(self, expr1, expr2, msg=None)
| Just like self.assertTrue(a is b), but with a nicer default message.
|
| assertIsInstance(self, obj, cls, msg=None)
| Same as self.assertTrue(isinstance(obj, cls)), with a nicer
| default message.
|
| assertIsNone(self, obj, msg=None)
| Same as self.assertTrue(obj is None), with a nicer default message.
|
| assertIsNot(self, expr1, expr2, msg=None)
| Just like self.assertTrue(a is not b), but with a nicer default message.
|
| assertIsNotNone(self, obj, msg=None)
| Included for symmetry with assertIsNone.
|
| assertItemsEqual(self, expected_seq, actual_seq, msg=None)
| An unordered sequence specific comparison. It asserts that
| actual_seq and expected_seq have the same element counts.
| Equivalent to::
|
| self.assertEqual(Counter(iter(actual_seq)),
| Counter(iter(expected_seq)))
|
| Asserts that each element has the same count in both sequences.
| Example:
| - [0, 1, 1] and [1, 0, 1] compare equal.
| - [0, 0, 1] and [0, 1] compare unequal.
|
| assertLess(self, a, b, msg=None)
| Just like self.assertTrue(a < b), but with a nicer default message.
|
| assertLessEqual(self, a, b, msg=None)
| Just like self.assertTrue(a <= b), but with a nicer default message.
|
| assertListEqual(self, list1, list2, msg=None)
| A list-specific equality assertion.
|
| Args:
| list1: The first list to compare.
| list2: The second list to compare.
| msg: Optional message to use on failure instead of a list of
| differences.
|
| assertMultiLineEqual(self, first, second, msg=None)
| Assert that two multi-line strings are equal.
|
| assertNotAlmostEqual(self, first, second, places=None, msg=None, delta=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, or by comparing that the
| between the two objects is less than the given delta.
|
| Note that decimal places (from zero) are usually not the same
| as significant digits (measured from the most signficant digit).
|
| Objects that are equal automatically fail.
|
| assertNotAlmostEquals = assertNotAlmostEqual(self, first, second, places=None, msg=None, delta=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, or by comparing that the
| between the two objects is less than the given delta.
|
| Note that decimal places (from zero) are usually not the same
| as significant digits (measured from the most signficant digit).
|
| Objects that are equal automatically fail.
|
| assertNotEqual(self, first, second, msg=None)
| Fail if the two objects are equal as determined by the '=='
| operator.
|
| assertNotEquals = assertNotEqual(self, first, second, msg=None)
| Fail if the two objects are equal as determined by the '=='
| operator.
|
| assertNotIn(self, member, container, msg=None)
| Just like self.assertTrue(a not in b), but with a nicer default message.
|
| assertNotIsInstance(self, obj, cls, msg=None)
| Included for symmetry with assertIsInstance.
|
| assertNotRegexpMatches(self, text, unexpected_regexp, msg=None)
| Fail the test if the text matches the regular expression.
|
| assertRaises(self, excClass, callableObj=None, *args, **kwargs)
| Fail unless an exception of class excClass is thrown
| by callableObj when invoked with arguments args and keyword
| arguments kwargs. If a different type of exception is
| thrown, it will not be caught, and the test case will be
| deemed to have suffered an error, exactly as for an
| unexpected exception.
|
| If called with callableObj omitted or None, will return a
| context object used like this::
|
| with self.assertRaises(SomeException):
| do_something()
|
| The context manager keeps a reference to the exception as
| the 'exception' attribute. This allows you to inspect the
| exception after the assertion::
|
| with self.assertRaises(SomeException) as cm:
| do_something()
| the_exception = cm.exception
| self.assertEqual(the_exception.error_code, 3)
|
| assertRaisesRegexp(self, expected_exception, expected_regexp, callable_obj=None, *args, **kwargs)
| Asserts that the message in a raised exception matches a regexp.
|
| Args:
| expected_exception: Exception class expected to be raised.
| expected_regexp: Regexp (re pattern object or string) expected
| to be found in error message.
| callable_obj: Function to be called.
| args: Extra args.
| kwargs: Extra kwargs.
|
| assertRegexpMatches(self, text, expected_regexp, msg=None)
| Fail the test unless the text matches the regular expression.
|
| assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None)
| An equality assertion for ordered sequences (like lists and tuples).
|
| For the purposes of this function, a valid ordered sequence type is one
| which can be indexed, has a length, and has an equality operator.
|
| Args:
| seq1: The first sequence to compare.
| seq2: The second sequence to compare.
| seq_type: The expected datatype of the sequences, or None if no
| datatype should be enforced.
| msg: Optional message to use on failure instead of a list of
| differences.
|
| assertSetEqual(self, set1, set2, msg=None)
| A set-specific equality assertion.
|
| Args:
| set1: The first set to compare.
| set2: The second set to compare.
| msg: Optional message to use on failure instead of a list of
| differences.
|
| assertSetEqual uses ducktyping to support different types of sets, and
| is optimized for sets specifically (parameters must support a
| difference method).
|
| assertTrue(self, expr, msg=None)
| Check that the expression is true.
|
| assertTupleEqual(self, tuple1, tuple2, msg=None)
| A tuple-specific equality assertion.
|
| Args:
| tuple1: The first tuple to compare.
| tuple2: The second tuple to compare.
| msg: Optional message to use on failure instead of a list of
| differences.
|
| assert_ = assertTrue(self, expr, msg=None)
| Check that the expression is true.
|
| countTestCases(self)
|
| debug(self)
| Run the test without collecting errors in a TestResult
|
| defaultTestResult(self)
|
| doCleanups(self)
| Execute all cleanup functions. Normally called for you after
| tearDown.
|
| fail(self, msg=None)
| Fail immediately, with the given message.
|
| failIf = deprecated_func(*args, **kwargs)
|
| failIfAlmostEqual = deprecated_func(*args, **kwargs)
|
| failIfEqual = deprecated_func(*args, **kwargs)
|
| failUnless = deprecated_func(*args, **kwargs)
|
| failUnlessAlmostEqual = deprecated_func(*args, **kwargs)
|
| failUnlessEqual = deprecated_func(*args, **kwargs)
|
| failUnlessRaises = deprecated_func(*args, **kwargs)
|
| id(self)
|
| run(self, result=None)
|
| shortDescription(self)
| Returns a one-line description of the test, or None if no
| description has been provided.
|
| The default implementation of this method returns the first line of
| the specified test method's docstring.
|
| skipTest(self, reason)
| Skip this test.
|
| tearDown(self)
| Hook method for deconstructing the test fixture after testing it.
|
| ----------------------------------------------------------------------
| Class methods inherited from unittest.case.TestCase:
|
| setUpClass(cls) from __builtin__.type
| Hook method for setting up class fixture before running tests in the class.
|
| tearDownClass(cls) from __builtin__.type
| Hook method for deconstructing the class fixture after running all tests in the class.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from unittest.case.TestCase:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from unittest.case.TestCase:
|
| failureException = <type 'exceptions.AssertionError'>
| Assertion failed.
|
| longMessage = False
|
| maxDiff = 640