[testlib] Remove deprecated assert methods

Including those that are already defined in unittest2 >= 0.5.1. Closes #1716063.

authorRémi Cardona <remi.cardona@logilab.fr>
changeset46afffcb247b
branchdefault
phasepublic
hiddenno
parent revision#2432940f1e7e [testlib] Remove old TestCase.assertRaises code
child revision#70be9fe027d7 [shellutils] Remove racy file lock
files modified by this revision
logilab/common/testlib.py
test/unittest_testlib.py
# HG changeset patch
# User Rémi Cardona <remi.cardona@logilab.fr>
# Date 1441893205 -7200
# Thu Sep 10 15:53:25 2015 +0200
# Node ID 46afffcb247bfe1419f6e374a8c7698f8c751b6b
# Parent 2432940f1e7e40482823d83b3580448cafd35e3b
[testlib] Remove deprecated assert methods

Including those that are already defined in unittest2 >= 0.5.1.
Closes #1716063.

diff --git a/logilab/common/testlib.py b/logilab/common/testlib.py
@@ -607,474 +607,19 @@
1 
2      def defaultTestResult(self):
3          """return a new instance of the defaultTestResult"""
4          return SkipAwareTestResult()
5 
6 -    skip = _deprecate(unittest.TestCase.skipTest)
7 -    assertEquals = _deprecate(unittest.TestCase.assertEqual)
8 -    assertNotEquals = _deprecate(unittest.TestCase.assertNotEqual)
9 -    assertAlmostEquals = _deprecate(unittest.TestCase.assertAlmostEqual)
10 -    assertNotAlmostEquals = _deprecate(unittest.TestCase.assertNotAlmostEqual)
11 -
12      def innerSkip(self, msg=None):
13          """mark a generative test as skipped for the <msg> reason"""
14          msg = msg or 'test was skipped'
15          raise InnerTestSkipped(msg)
16 
17 -    @deprecated('Please use assertDictEqual instead.')
18 -    def assertDictEquals(self, dict1, dict2, msg=None, context=None):
19 -        """compares two dicts
20 -
21 -        If the two dict differ, the first difference is shown in the error
22 -        message
23 -        :param dict1: a Python Dictionary
24 -        :param dict2: a Python Dictionary
25 -        :param msg: custom message (String) in case of failure
26 -        """
27 -        dict1 = dict(dict1)
28 -        msgs = []
29 -        for key, value in dict2.items():
30 -            try:
31 -                if dict1[key] != value:
32 -                    msgs.append('%r != %r for key %r' % (dict1[key], value,
33 -                        key))
34 -                del dict1[key]
35 -            except KeyError:
36 -                msgs.append('missing %r key' % key)
37 -        if dict1:
38 -            msgs.append('dict2 is lacking %r' % dict1)
39 -        if msg:
40 -            self.failureException(msg)
41 -        elif msgs:
42 -            if context is not None:
43 -                base = '%s\n' % context
44 -            else:
45 -                base = ''
46 -            self.fail(base + '\n'.join(msgs))
47 -
48 -    @deprecated('Please use assertCountEqual instead.')
49 -    def assertUnorderedIterableEquals(self, got, expected, msg=None):
50 -        """compares two iterable and shows difference between both
51 -
52 -        :param got: the unordered Iterable that we found
53 -        :param expected: the expected unordered Iterable
54 -        :param msg: custom message (String) in case of failure
55 -        """
56 -        got, expected = list(got), list(expected)
57 -        self.assertSetEqual(set(got), set(expected), msg)
58 -        if len(got) != len(expected):
59 -            if msg is None:
60 -                msg = ['Iterable have the same elements but not the same number',
61 -                       '\t<element>\t<expected>i\t<got>']
62 -                got_count = {}
63 -                expected_count = {}
64 -                for element in got:
65 -                    got_count[element] = got_count.get(element, 0) + 1
66 -                for element in expected:
67 -                    expected_count[element] = expected_count.get(element, 0) + 1
68 -                # we know that got_count.key() == expected_count.key()
69 -                # because of assertSetEqual
70 -                for element, count in got_count.iteritems():
71 -                    other_count = expected_count[element]
72 -                    if other_count != count:
73 -                        msg.append('\t%s\t%s\t%s' % (element, other_count, count))
74 -
75 -            self.fail(msg)
76 -
77 -    assertUnorderedIterableEqual = assertUnorderedIterableEquals
78 -    assertUnordIterEquals = assertUnordIterEqual = assertUnorderedIterableEqual
79 -
80 -    @deprecated('Please use assertSetEqual instead.')
81 -    def assertSetEquals(self,got,expected, msg=None):
82 -        """compares two sets and shows difference between both
83 -
84 -        Don't use it for iterables other than sets.
85 -
86 -        :param got: the Set that we found
87 -        :param expected: the second Set to be compared to the first one
88 -        :param msg: custom message (String) in case of failure
89 -        """
90 -
91 -        if not(isinstance(got, set) and isinstance(expected, set)):
92 -            warnings.warn("the assertSetEquals function if now intended for set only."\
93 -                          "use assertUnorderedIterableEquals instead.",
94 -                DeprecationWarning, 2)
95 -            return self.assertUnorderedIterableEquals(got, expected, msg)
96 -
97 -        items={}
98 -        items['missing'] = expected - got
99 -        items['unexpected'] = got - expected
100 -        if any(items.itervalues()):
101 -            if msg is None:
102 -                msg = '\n'.join('%s:\n\t%s' % (key, "\n\t".join(str(value) for value in values))
103 -                    for key, values in items.iteritems() if values)
104 -            self.fail(msg)
105 -
106 -    @deprecated('Please use assertListEqual instead.')
107 -    def assertListEquals(self, list_1, list_2, msg=None):
108 -        """compares two lists
109 -
110 -        If the two list differ, the first difference is shown in the error
111 -        message
112 -
113 -        :param list_1: a Python List
114 -        :param list_2: a second Python List
115 -        :param msg: custom message (String) in case of failure
116 -        """
117 -        _l1 = list_1[:]
118 -        for i, value in enumerate(list_2):
119 -            try:
120 -                if _l1[0] != value:
121 -                    from pprint import pprint
122 -                    pprint(list_1)
123 -                    pprint(list_2)
124 -                    self.fail('%r != %r for index %d' % (_l1[0], value, i))
125 -                del _l1[0]
126 -            except IndexError:
127 -                if msg is None:
128 -                    msg = 'list_1 has only %d elements, not %s '\
129 -                        '(at least %r missing)'% (i, len(list_2), value)
130 -                self.fail(msg)
131 -        if _l1:
132 -            if msg is None:
133 -                msg = 'list_2 is lacking %r' % _l1
134 -            self.fail(msg)
135 -
136 -    @deprecated('Non-standard. Please use assertMultiLineEqual instead.')
137 -    def assertLinesEquals(self, string1, string2, msg=None, striplines=False):
138 -        """compare two strings and assert that the text lines of the strings
139 -        are equal.
140 -
141 -        :param string1: a String
142 -        :param string2: a String
143 -        :param msg: custom message (String) in case of failure
144 -        :param striplines: Boolean to trigger line stripping before comparing
145 -        """
146 -        lines1 = string1.splitlines()
147 -        lines2 = string2.splitlines()
148 -        if striplines:
149 -            lines1 = [l.strip() for l in lines1]
150 -            lines2 = [l.strip() for l in lines2]
151 -        self.assertListEqual(lines1, lines2, msg)
152 -    assertLineEqual = assertLinesEquals
153 -
154 -    @deprecated('Non-standard: please copy test method to your TestCase class')
155 -    def assertXMLWellFormed(self, stream, msg=None, context=2):
156 -        """asserts the XML stream is well-formed (no DTD conformance check)
157 -
158 -        :param context: number of context lines in standard message
159 -                        (show all data if negative).
160 -                        Only available with element tree
161 -        """
162 -        try:
163 -            from xml.etree.ElementTree import parse
164 -            self._assertETXMLWellFormed(stream, parse, msg)
165 -        except ImportError:
166 -            from xml.sax import make_parser, SAXParseException
167 -            parser = make_parser()
168 -            try:
169 -                parser.parse(stream)
170 -            except SAXParseException as ex:
171 -                if msg is None:
172 -                    stream.seek(0)
173 -                    for _ in range(ex.getLineNumber()):
174 -                        line = stream.readline()
175 -                    pointer = ('' * (ex.getLineNumber() - 1)) + '^'
176 -                    msg = 'XML stream not well formed: %s\n%s%s' % (ex, line, pointer)
177 -                self.fail(msg)
178 -
179 -    @deprecated('Non-standard: please copy test method to your TestCase class')
180 -    def assertXMLStringWellFormed(self, xml_string, msg=None, context=2):
181 -        """asserts the XML string is well-formed (no DTD conformance check)
182 -
183 -        :param context: number of context lines in standard message
184 -                        (show all data if negative).
185 -                        Only available with element tree
186 -        """
187 -        try:
188 -            from xml.etree.ElementTree import fromstring
189 -        except ImportError:
190 -            from elementtree.ElementTree import fromstring
191 -        self._assertETXMLWellFormed(xml_string, fromstring, msg)
192 -
193 -    def _assertETXMLWellFormed(self, data, parse, msg=None, context=2):
194 -        """internal function used by /assertXML(String)?WellFormed/ functions
195 -
196 -        :param data: xml_data
197 -        :param parse: appropriate parser function for this data
198 -        :param msg: error message
199 -        :param context: number of context lines in standard message
200 -                        (show all data if negative).
201 -                        Only available with element tree
202 -        """
203 -        from xml.parsers.expat import ExpatError
204 -        try:
205 -            from xml.etree.ElementTree import ParseError
206 -        except ImportError:
207 -            # compatibility for <python2.7
208 -            ParseError = ExpatError
209 -        try:
210 -            parse(data)
211 -        except (ExpatError, ParseError) as ex:
212 -            if msg is None:
213 -                if hasattr(data, 'readlines'): #file like object
214 -                    data.seek(0)
215 -                    lines = data.readlines()
216 -                else:
217 -                    lines = data.splitlines(True)
218 -                nb_lines = len(lines)
219 -                context_lines = []
220 -
221 -                # catch when ParseError doesn't set valid lineno
222 -                if ex.lineno is not None:
223 -                    if context < 0:
224 -                        start = 1
225 -                        end   = nb_lines
226 -                    else:
227 -                        start = max(ex.lineno-context, 1)
228 -                        end   = min(ex.lineno+context, nb_lines)
229 -                    line_number_length = len('%i' % end)
230 -                    line_pattern = " %%%ii: %%s" % line_number_length
231 -
232 -                    for line_no in range(start, ex.lineno):
233 -                        context_lines.append(line_pattern % (line_no, lines[line_no-1]))
234 -                    context_lines.append(line_pattern % (ex.lineno, lines[ex.lineno-1]))
235 -                    context_lines.append('%s^\n' % (' ' * (1 + line_number_length + 2 +ex.offset)))
236 -                    for line_no in range(ex.lineno+1, end+1):
237 -                        context_lines.append(line_pattern % (line_no, lines[line_no-1]))
238 -
239 -                rich_context = ''.join(context_lines)
240 -                msg = 'XML stream not well formed: %s\n%s' % (ex, rich_context)
241 -            self.fail(msg)
242 -
243 -    @deprecated('Non-standard: please copy test method to your TestCase class')
244 -    def assertXMLEqualsTuple(self, element, tup):
245 -        """compare an ElementTree Element to a tuple formatted as follow:
246 -        (tagname, [attrib[, children[, text[, tail]]]])"""
247 -        # check tag
248 -        self.assertTextEquals(element.tag, tup[0])
249 -        # check attrib
250 -        if len(element.attrib) or len(tup)>1:
251 -            if len(tup)<=1:
252 -                self.fail( "tuple %s has no attributes (%s expected)"%(tup,
253 -                    dict(element.attrib)))
254 -            self.assertDictEqual(element.attrib, tup[1])
255 -        # check children
256 -        if len(element) or len(tup)>2:
257 -            if len(tup)<=2:
258 -                self.fail( "tuple %s has no children (%i expected)"%(tup,
259 -                    len(element)))
260 -            if len(element) != len(tup[2]):
261 -                self.fail( "tuple %s has %i children%s (%i expected)"%(tup,
262 -                    len(tup[2]),
263 -                        ('', 's')[len(tup[2])>1], len(element)))
264 -            for index in range(len(tup[2])):
265 -                self.assertXMLEqualsTuple(element[index], tup[2][index])
266 -        #check text
267 -        if element.text or len(tup)>3:
268 -            if len(tup)<=3:
269 -                self.fail( "tuple %s has no text value (%r expected)"%(tup,
270 -                    element.text))
271 -            self.assertTextEquals(element.text, tup[3])
272 -        #check tail
273 -        if element.tail or len(tup)>4:
274 -            if len(tup)<=4:
275 -                self.fail( "tuple %s has no tail value (%r expected)"%(tup,
276 -                    element.tail))
277 -            self.assertTextEquals(element.tail, tup[4])
278 -
279 -    def _difftext(self, lines1, lines2, junk=None, msg_prefix='Texts differ'):
280 -        junk = junk or (' ', '\t')
281 -        # result is a generator
282 -        result = difflib.ndiff(lines1, lines2, charjunk=lambda x: x in junk)
283 -        read = []
284 -        for line in result:
285 -            read.append(line)
286 -            # lines that don't start with a ' ' are diff ones
287 -            if not line.startswith(' '):
288 -                self.fail('\n'.join(['%s\n'%msg_prefix]+read + list(result)))
289 -
290 -    @deprecated('Non-standard. Please use assertMultiLineEqual instead.')
291 -    def assertTextEquals(self, text1, text2, junk=None,
292 -            msg_prefix='Text differ', striplines=False):
293 -        """compare two multiline strings (using difflib and splitlines())
294 -
295 -        :param text1: a Python BaseString
296 -        :param text2: a second Python Basestring
297 -        :param junk: List of Caracters
298 -        :param msg_prefix: String (message prefix)
299 -        :param striplines: Boolean to trigger line stripping before comparing
300 -        """
301 -        msg = []
302 -        if not isinstance(text1, string_types):
303 -            msg.append('text1 is not a string (%s)'%(type(text1)))
304 -        if not isinstance(text2, string_types):
305 -            msg.append('text2 is not a string (%s)'%(type(text2)))
306 -        if msg:
307 -            self.fail('\n'.join(msg))
308 -        lines1 = text1.strip().splitlines(True)
309 -        lines2 = text2.strip().splitlines(True)
310 -        if striplines:
311 -            lines1 = [line.strip() for line in lines1]
312 -            lines2 = [line.strip() for line in lines2]
313 -        self._difftext(lines1, lines2, junk,  msg_prefix)
314 -    assertTextEqual = assertTextEquals
315 -
316 -    @deprecated('Non-standard: please copy test method to your TestCase class')
317 -    def assertStreamEquals(self, stream1, stream2, junk=None,
318 -            msg_prefix='Stream differ'):
319 -        """compare two streams (using difflib and readlines())"""
320 -        # if stream2 is stream2, readlines() on stream1 will also read lines
321 -        # in stream2, so they'll appear different, although they're not
322 -        if stream1 is stream2:
323 -            return
324 -        # make sure we compare from the beginning of the stream
325 -        stream1.seek(0)
326 -        stream2.seek(0)
327 -        # compare
328 -        self._difftext(stream1.readlines(), stream2.readlines(), junk,
329 -             msg_prefix)
330 -
331 -    assertStreamEqual = assertStreamEquals
332 -
333 -    @deprecated('Non-standard: please copy test method to your TestCase class')
334 -    def assertFileEquals(self, fname1, fname2, junk=(' ', '\t')):
335 -        """compares two files using difflib"""
336 -        self.assertStreamEqual(open(fname1), open(fname2), junk,
337 -            msg_prefix='Files differs\n-:%s\n+:%s\n'%(fname1, fname2))
338 -
339 -    assertFileEqual = assertFileEquals
340 -
341 -    @deprecated('Non-standard: please copy test method to your TestCase class')
342 -    def assertDirEquals(self, path_a, path_b):
343 -        """compares two files using difflib"""
344 -        assert osp.exists(path_a), "%s doesn't exists" % path_a
345 -        assert osp.exists(path_b), "%s doesn't exists" % path_b
346 -
347 -        all_a = [ (ipath[len(path_a):].lstrip('/'), idirs, ifiles)
348 -                    for ipath, idirs, ifiles in os.walk(path_a)]
349 -        all_a.sort(key=itemgetter(0))
350 -
351 -        all_b = [ (ipath[len(path_b):].lstrip('/'), idirs, ifiles)
352 -                    for ipath, idirs, ifiles in os.walk(path_b)]
353 -        all_b.sort(key=itemgetter(0))
354 -
355 -        iter_a, iter_b = iter(all_a), iter(all_b)
356 -        partial_iter = True
357 -        ipath_a, idirs_a, ifiles_a = data_a = None, None, None
358 -        while True:
359 -            try:
360 -                ipath_a, idirs_a, ifiles_a = datas_a = next(iter_a)
361 -                partial_iter = False
362 -                ipath_b, idirs_b, ifiles_b = datas_b = next(iter_b)
363 -                partial_iter = True
364 -
365 -
366 -                self.assertTrue(ipath_a == ipath_b,
367 -                    "unexpected %s in %s while looking %s from %s" %
368 -                    (ipath_a, path_a, ipath_b, path_b))
369 -
370 -
371 -                errors = {}
372 -                sdirs_a = set(idirs_a)
373 -                sdirs_b = set(idirs_b)
374 -                errors["unexpected directories"] = sdirs_a - sdirs_b
375 -                errors["missing directories"] = sdirs_b - sdirs_a
376 -
377 -                sfiles_a = set(ifiles_a)
378 -                sfiles_b = set(ifiles_b)
379 -                errors["unexpected files"] = sfiles_a - sfiles_b
380 -                errors["missing files"] = sfiles_b - sfiles_a
381 -
382 -
383 -                msgs = [ "%s: %s"% (name, items)
384 -                    for name, items in errors.items() if items]
385 -
386 -                if msgs:
387 -                    msgs.insert(0, "%s and %s differ :" % (
388 -                        osp.join(path_a, ipath_a),
389 -                        osp.join(path_b, ipath_b),
390 -                        ))
391 -                    self.fail("\n".join(msgs))
392 -
393 -                for files in (ifiles_a, ifiles_b):
394 -                    files.sort()
395 -
396 -                for index, path in enumerate(ifiles_a):
397 -                    self.assertFileEquals(osp.join(path_a, ipath_a, path),
398 -                        osp.join(path_b, ipath_b, ifiles_b[index]))
399 -
400 -            except StopIteration:
401 -                break
402 -
403 -    assertDirEqual = assertDirEquals
404 -
405 -    def assertIsInstance(self, obj, klass, msg=None, strict=False):
406 -        """check if an object is an instance of a class
407 -
408 -        :param obj: the Python Object to be checked
409 -        :param klass: the target class
410 -        :param msg: a String for a custom message
411 -        :param strict: if True, check that the class of <obj> is <klass>;
412 -                       else check with 'isinstance'
413 -        """
414 -        if strict:
415 -            warnings.warn('[API] Non-standard. Strict parameter has vanished',
416 -                          DeprecationWarning, stacklevel=2)
417 -        if msg is None:
418 -            if strict:
419 -                msg = '%r is not of class %s but of %s'
420 -            else:
421 -                msg = '%r is not an instance of %s but of %s'
422 -            msg = msg % (obj, klass, type(obj))
423 -        if strict:
424 -            self.assertTrue(obj.__class__ is klass, msg)
425 -        else:
426 -            self.assertTrue(isinstance(obj, klass), msg)
427 -
428 -    @deprecated('Please use assertIsNone instead.')
429 -    def assertNone(self, obj, msg=None):
430 -        """assert obj is None
431 -
432 -        :param obj: Python Object to be tested
433 -        """
434 -        if msg is None:
435 -            msg = "reference to %r when None expected"%(obj,)
436 -        self.assertTrue( obj is None, msg )
437 -
438 -    @deprecated('Please use assertIsNotNone instead.')
439 -    def assertNotNone(self, obj, msg=None):
440 -        """assert obj is not None"""
441 -        if msg is None:
442 -            msg = "unexpected reference to None"
443 -        self.assertTrue( obj is not None, msg )
444 -
445 -    @deprecated('Non-standard. Please use assertAlmostEqual instead.')
446 -    def assertFloatAlmostEquals(self, obj, other, prec=1e-5,
447 -                                relative=False, msg=None):
448 -        """compares if two floats have a distance smaller than expected
449 -        precision.
450 -
451 -        :param obj: a Float
452 -        :param other: another Float to be comparted to <obj>
453 -        :param prec: a Float describing the precision
454 -        :param relative: boolean switching to relative/absolute precision
455 -        :param msg: a String for a custom message
456 -        """
457 -        if msg is None:
458 -            msg = "%r != %r" % (obj, other)
459 -        if relative:
460 -            prec = prec*math.fabs(obj)
461 -        self.assertTrue(math.fabs(obj - other) < prec, msg)
462 -
463      if sys.version_info >= (3,2):
464          assertItemsEqual = unittest.TestCase.assertCountEqual
465      else:
466          assertCountEqual = unittest.TestCase.assertItemsEqual
467 -        if sys.version_info < (2,7):
468 -            def assertIsNotNone(self, value, *args, **kwargs):
469 -                self.assertNotEqual(None, value, *args, **kwargs)
470 
471  TestCase.assertItemsEqual = deprecated('assertItemsEqual is deprecated, use assertCountEqual')(
472      TestCase.assertItemsEqual)
473 
474  import doctest
diff --git a/test/unittest_testlib.py b/test/unittest_testlib.py
@@ -111,65 +111,17 @@
475          self.assertRaises(AssertionError, self.tc.assertListEqual, l1, l2)
476          self.tc.assertListEqual(l1, l1)
477          self.tc.assertListEqual(l1, l3)
478          self.tc.assertListEqual(l3, l1)
479 
480 -    def test_xml_valid(self):
481 -        """tests xml is valid"""
482 -        valid = """<root>
483 -        <hello />
484 -        <world>Logilab</world>
485 -        </root>"""
486 -        invalid = """<root><h2> </root>"""
487 -        self.tc.assertXMLStringWellFormed(valid)
488 -        self.assertRaises(AssertionError, self.tc.assertXMLStringWellFormed, invalid)
489 -        invalid = """<root><h2 </h2> </root>"""
490 -        self.assertRaises(AssertionError, self.tc.assertXMLStringWellFormed, invalid)
491 -
492      def test_equality_for_sets(self):
493          s1 = set('ab')
494          s2 = set('a')
495          self.assertRaises(AssertionError, self.tc.assertSetEqual, s1, s2)
496          self.tc.assertSetEqual(s1, s1)
497          self.tc.assertSetEqual(set(), set())
498 
499 -    def test_file_equality(self):
500 -        foo = join(dirname(__file__), 'data', 'foo.txt')
501 -        spam = join(dirname(__file__), 'data', 'spam.txt')
502 -        self.assertRaises(AssertionError, self.tc.assertFileEqual, foo, spam)
503 -        self.tc.assertFileEqual(foo, foo)
504 -
505 -    def test_dir_equality(self):
506 -        ref = join(dirname(__file__), 'data', 'reference_dir')
507 -        same = join(dirname(__file__), 'data', 'same_dir')
508 -        subdir_differ = join(dirname(__file__), 'data', 'subdir_differ_dir')
509 -        file_differ = join(dirname(__file__), 'data', 'file_differ_dir')
510 -        content_differ = join(dirname(__file__), 'data', 'content_differ_dir')
511 -        ed1 = join(dirname(__file__), 'data', 'empty_dir_1')
512 -        ed2 = join(dirname(__file__), 'data', 'empty_dir_2')
513 -
514 -        for path in (ed1, ed2, join(subdir_differ, 'unexpected')):
515 -            self.mkdir(path)
516 -
517 -        self.assertDirEqual(ed1, ed2)
518 -        self.assertDirEqual(ref, ref)
519 -        self.assertDirEqual( ref, same)
520 -        self.assertRaises(AssertionError, self.assertDirEqual, ed1, ref)
521 -        self.assertRaises(AssertionError, self.assertDirEqual, ref, ed2)
522 -        self.assertRaises(AssertionError, self.assertDirEqual, subdir_differ, ref)
523 -        self.assertRaises(AssertionError, self.assertDirEqual, file_differ, ref)
524 -        self.assertRaises(AssertionError, self.assertDirEqual, ref, content_differ)
525 -
526 -    def test_stream_equality(self):
527 -        foo = join(dirname(__file__), 'data', 'foo.txt')
528 -        spam = join(dirname(__file__), 'data', 'spam.txt')
529 -        stream1 = open(foo)
530 -        self.tc.assertStreamEqual(stream1, stream1)
531 -        stream1 = open(foo)
532 -        stream2 = open(spam)
533 -        self.assertRaises(AssertionError, self.tc.assertStreamEqual, stream1, stream2)
534 -
535      def test_text_equality(self):
536          self.assertRaises(AssertionError, self.tc.assertMultiLineEqual, "toto", 12)
537          self.assertRaises(AssertionError, self.tc.assertMultiLineEqual, "toto", 12)
538          self.assertRaises(AssertionError, self.tc.assertMultiLineEqual, "toto", None)
539          self.assertRaises(AssertionError, self.tc.assertMultiLineEqual, "toto", None)