<s> import difflib <EOL> import pprint <EOL> import re <EOL> from copy import deepcopy <EOL> import unittest2 <EOL> from unittest2 . test . support import ( <EOL> OldTestResult , EqualityMixin , HashingMixin , LoggingResult <EOL> ) <EOL> class MyException ( Exception ) : <EOL> pass <EOL> class Test ( object ) : <EOL> "<STR_LIT>" <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def runTest ( self ) : pass <EOL> def test1 ( self ) : pass <EOL> class Bar ( Foo ) : <EOL> def test2 ( self ) : pass <EOL> class LoggingTestCase ( unittest2 . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , events ) : <EOL> super ( Test . LoggingTestCase , self ) . __init__ ( '<STR_LIT:test>' ) <EOL> self . events = events <EOL> def setUp ( self ) : <EOL> self . events . append ( '<STR_LIT>' ) <EOL> def test ( self ) : <EOL> self . events . append ( '<STR_LIT:test>' ) <EOL> def tearDown ( self ) : <EOL> self . events . append ( '<STR_LIT>' ) <EOL> class TestCleanUp ( unittest2 . TestCase ) : <EOL> def testCleanUp ( self ) : <EOL> class TestableTest ( unittest2 . TestCase ) : <EOL> def testNothing ( self ) : <EOL> pass <EOL> test = TestableTest ( '<STR_LIT>' ) <EOL> self . assertEqual ( test . _cleanups , [ ] ) <EOL> cleanups = [ ] <EOL> def cleanup1 ( * args , ** kwargs ) : <EOL> cleanups . append ( ( <NUM_LIT:1> , args , kwargs ) ) <EOL> def cleanup2 ( * args , ** kwargs ) : <EOL> cleanups . append ( ( <NUM_LIT:2> , args , kwargs ) ) <EOL> test . addCleanup ( cleanup1 , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , four = '<STR_LIT:hello>' , five = '<STR_LIT>' ) <EOL> test . addCleanup ( cleanup2 ) <EOL> self . assertEqual ( test . _cleanups , <EOL> [ ( cleanup1 , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , dict ( four = '<STR_LIT:hello>' , five = '<STR_LIT>' ) ) , <EOL> ( cleanup2 , ( ) , { } ) ] ) <EOL> result = test . doCleanups ( ) <EOL> self . assertTrue ( result ) <EOL> self . assertEqual ( cleanups , [ ( <NUM_LIT:2> , ( ) , { } ) , ( <NUM_LIT:1> , ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , dict ( four = '<STR_LIT:hello>' , five = '<STR_LIT>' ) ) ] ) <EOL> def testCleanUpWithErrors ( self ) : <EOL> class TestableTest ( unittest2 . TestCase ) : <EOL> def testNothing ( self ) : <EOL> pass <EOL> class MockResult ( object ) : <EOL> errors = [ ] <EOL> def addError ( self , test , exc_info ) : <EOL> self . errors . append ( ( test , exc_info ) ) <EOL> result = MockResult ( ) <EOL> test = TestableTest ( '<STR_LIT>' ) <EOL> test . _resultForDoCleanups = result <EOL> exc1 = Exception ( '<STR_LIT:foo>' ) <EOL> exc2 = Exception ( '<STR_LIT:bar>' ) <EOL> def cleanup1 ( ) : <EOL> raise exc1 <EOL> def cleanup2 ( ) : <EOL> raise exc2 <EOL> test . addCleanup ( cleanup1 ) <EOL> test . addCleanup ( cleanup2 ) <EOL> self . assertFalse ( test . doCleanups ( ) ) <EOL> ( test1 , ( Type1 , instance1 , _ ) ) , ( test2 , ( Type2 , instance2 , _ ) ) = reversed ( MockResult . errors ) <EOL> self . assertEqual ( ( test1 , Type1 , instance1 ) , ( test , Exception , exc1 ) ) <EOL> self . assertEqual ( ( test2 , Type2 , instance2 ) , ( test , Exception , exc2 ) ) <EOL> def testCleanupInRun ( self ) : <EOL> blowUp = False <EOL> ordering = [ ] <EOL> class TestableTest ( unittest2 . TestCase ) : <EOL> def setUp ( self ) : <EOL> ordering . append ( '<STR_LIT>' ) <EOL> if blowUp : <EOL> raise Exception ( '<STR_LIT:foo>' ) <EOL> def testNothing ( self ) : <EOL> ordering . append ( '<STR_LIT:test>' ) <EOL> def tearDown ( self ) : <EOL> ordering . append ( '<STR_LIT>' ) <EOL> test = TestableTest ( '<STR_LIT>' ) <EOL> def cleanup1 ( ) : <EOL> ordering . append ( '<STR_LIT>' ) <EOL> def cleanup2 ( ) : <EOL> ordering . append ( '<STR_LIT>' ) <EOL> test . addCleanup ( cleanup1 ) <EOL> test . addCleanup ( cleanup2 ) <EOL> def success ( some_test ) : <EOL> self . assertEqual ( some_test , test ) <EOL> ordering . append ( '<STR_LIT:success>' ) <EOL> result = unittest2 . TestResult ( ) <EOL> result . addSuccess = success <EOL> test . run ( result ) <EOL> self . assertEqual ( ordering , [ '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:success>' ] ) <EOL> blowUp = True <EOL> ordering = [ ] <EOL> test = TestableTest ( '<STR_LIT>' ) <EOL> test . addCleanup ( cleanup1 ) <EOL> test . run ( result ) <EOL> self . assertEqual ( ordering , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def testTestCaseDebugExecutesCleanups ( self ) : <EOL> ordering = [ ] <EOL> class TestableTest ( unittest2 . TestCase ) : <EOL> def setUp ( self ) : <EOL> ordering . append ( '<STR_LIT>' ) <EOL> self . addCleanup ( cleanup1 ) <EOL> def testNothing ( self ) : <EOL> ordering . append ( '<STR_LIT:test>' ) <EOL> def tearDown ( self ) : <EOL> ordering . append ( '<STR_LIT>' ) <EOL> test = TestableTest ( '<STR_LIT>' ) <EOL> def cleanup1 ( ) : <EOL> ordering . append ( '<STR_LIT>' ) <EOL> test . addCleanup ( cleanup2 ) <EOL> def cleanup2 ( ) : <EOL> ordering . append ( '<STR_LIT>' ) <EOL> test . debug ( ) <EOL> self . assertEqual ( ordering , [ '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> class Test_TestCase ( unittest2 . TestCase , EqualityMixin , HashingMixin ) : <EOL> eq_pairs = [ ( Test . Foo ( '<STR_LIT>' ) , Test . Foo ( '<STR_LIT>' ) ) ] <EOL> ne_pairs = [ ( Test . Foo ( '<STR_LIT>' ) , Test . Foo ( '<STR_LIT>' ) ) , <EOL> ( Test . Foo ( '<STR_LIT>' ) , Test . Bar ( '<STR_LIT>' ) ) , <EOL> ( Test . Foo ( '<STR_LIT>' ) , Test . Bar ( '<STR_LIT>' ) ) ] <EOL> def test_init__no_test_name ( self ) : <EOL> class Test ( unittest2 . TestCase ) : <EOL> def runTest ( self ) : raise MyException ( ) <EOL> def test ( self ) : pass <EOL> self . assertEqual ( Test ( ) . id ( ) [ - <NUM_LIT> : ] , '<STR_LIT>' ) <EOL> def test_init__test_name__valid ( self ) : <EOL> class Test ( unittest2 . TestCase ) : <EOL> def runTest ( self ) : raise MyException ( ) <EOL> def test ( self ) : pass <EOL> self . assertEqual ( Test ( '<STR_LIT:test>' ) . id ( ) [ - <NUM_LIT:10> : ] , '<STR_LIT>' ) <EOL> def test_init__test_name__invalid ( self ) : <EOL> class Test ( unittest2 . TestCase ) : <EOL> def runTest ( self ) : raise MyException ( ) <EOL> def test ( self ) : pass <EOL> try : <EOL> Test ( '<STR_LIT>' ) <EOL> except ValueError : <EOL> pass <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_countTestCases ( self ) : <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def test ( self ) : pass <EOL> self . assertEqual ( Foo ( '<STR_LIT:test>' ) . countTestCases ( ) , <NUM_LIT:1> ) <EOL> def test_defaultTestResult ( self ) : <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def runTest ( self ) : <EOL> pass <EOL> result = Foo ( ) . defaultTestResult ( ) <EOL> self . assertEqual ( type ( result ) , unittest2 . TestResult ) <EOL> def test_run_call_order__error_in_setUp ( self ) : <EOL> events = [ ] <EOL> result = LoggingResult ( events ) <EOL> class Foo ( Test . LoggingTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( Foo , self ) . setUp ( ) <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> Foo ( events ) . run ( result ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertEqual ( events , expected ) <EOL> def test_run_call_order__error_in_setUp_default_result ( self ) : <EOL> events = [ ] <EOL> class Foo ( Test . LoggingTestCase ) : <EOL> def defaultTestResult ( self ) : <EOL> return LoggingResult ( self . events ) <EOL> def setUp ( self ) : <EOL> super ( Foo , self ) . setUp ( ) <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> Foo ( events ) . run ( ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertEqual ( events , expected ) <EOL> def test_run_call_order__error_in_test ( self ) : <EOL> events = [ ] <EOL> result = LoggingResult ( events ) <EOL> class Foo ( Test . LoggingTestCase ) : <EOL> def test ( self ) : <EOL> super ( Foo , self ) . test ( ) <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> Foo ( events ) . run ( result ) <EOL> self . assertEqual ( events , expected ) <EOL> def test_run_call_order__error_in_test_default_result ( self ) : <EOL> events = [ ] <EOL> class Foo ( Test . LoggingTestCase ) : <EOL> def defaultTestResult ( self ) : <EOL> return LoggingResult ( self . events ) <EOL> def test ( self ) : <EOL> super ( Foo , self ) . test ( ) <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> Foo ( events ) . run ( ) <EOL> self . assertEqual ( events , expected ) <EOL> def test_run_call_order__failure_in_test ( self ) : <EOL> events = [ ] <EOL> result = LoggingResult ( events ) <EOL> class Foo ( Test . LoggingTestCase ) : <EOL> def test ( self ) : <EOL> super ( Foo , self ) . test ( ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> Foo ( events ) . run ( result ) <EOL> self . assertEqual ( events , expected ) <EOL> def test_run_call_order__failure_in_test_default_result ( self ) : <EOL> class Foo ( Test . LoggingTestCase ) : <EOL> def defaultTestResult ( self ) : <EOL> return LoggingResult ( self . events ) <EOL> def test ( self ) : <EOL> super ( Foo , self ) . test ( ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> events = [ ] <EOL> Foo ( events ) . run ( ) <EOL> self . assertEqual ( events , expected ) <EOL> def test_run_call_order__error_in_tearDown ( self ) : <EOL> events = [ ] <EOL> result = LoggingResult ( events ) <EOL> class Foo ( Test . LoggingTestCase ) : <EOL> def tearDown ( self ) : <EOL> super ( Foo , self ) . tearDown ( ) <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> Foo ( events ) . run ( result ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> self . assertEqual ( events , expected ) <EOL> def test_run_call_order__error_in_tearDown_default_result ( self ) : <EOL> class Foo ( Test . LoggingTestCase ) : <EOL> def defaultTestResult ( self ) : <EOL> return LoggingResult ( self . events ) <EOL> def tearDown ( self ) : <EOL> super ( Foo , self ) . tearDown ( ) <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> events = [ ] <EOL> Foo ( events ) . run ( ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertEqual ( events , expected ) <EOL> def test_run_call_order_default_result ( self ) : <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def defaultTestResult ( self ) : <EOL> return OldTestResult ( ) <EOL> def test ( self ) : <EOL> pass <EOL> Foo ( '<STR_LIT:test>' ) . run ( ) <EOL> def test_failureException__default ( self ) : <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def test ( self ) : <EOL> pass <EOL> self . assertTrue ( Foo ( '<STR_LIT:test>' ) . failureException is AssertionError ) <EOL> def test_failureException__subclassing__explicit_raise ( self ) : <EOL> events = [ ] <EOL> result = LoggingResult ( events ) <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def test ( self ) : <EOL> raise RuntimeError ( ) <EOL> failureException = RuntimeError <EOL> self . assertTrue ( Foo ( '<STR_LIT:test>' ) . failureException is RuntimeError ) <EOL> Foo ( '<STR_LIT:test>' ) . run ( result ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertEqual ( events , expected ) <EOL> def test_failureException__subclassing__implicit_raise ( self ) : <EOL> events = [ ] <EOL> result = LoggingResult ( events ) <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def test ( self ) : <EOL> self . fail ( "<STR_LIT:foo>" ) <EOL> failureException = RuntimeError <EOL> self . assertTrue ( Foo ( '<STR_LIT:test>' ) . failureException is RuntimeError ) <EOL> Foo ( '<STR_LIT:test>' ) . run ( result ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertEqual ( events , expected ) <EOL> def test_setUp ( self ) : <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def runTest ( self ) : <EOL> pass <EOL> Foo ( ) . setUp ( ) <EOL> def test_tearDown ( self ) : <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def runTest ( self ) : <EOL> pass <EOL> Foo ( ) . tearDown ( ) <EOL> def test_id ( self ) : <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def runTest ( self ) : <EOL> pass <EOL> self . assertIsInstance ( Foo ( ) . id ( ) , basestring ) <EOL> def test_run__uses_defaultTestResult ( self ) : <EOL> events = [ ] <EOL> class Foo ( unittest2 . TestCase ) : <EOL> def test ( self ) : <EOL> events . append ( '<STR_LIT:test>' ) <EOL> def defaultTestResult ( self ) : <EOL> return LoggingResult ( events ) <EOL> Foo ( '<STR_LIT:test>' ) . run ( ) <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertEqual ( events , expected ) <EOL> def testShortDescriptionWithoutDocstring ( self ) : <EOL> self . assertIsNone ( self . shortDescription ( ) ) <EOL> def testShortDescriptionWithOneLineDocstring ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( <EOL> self . shortDescription ( ) , <EOL> '<STR_LIT>' ) <EOL> def testShortDescriptionWithMultiLineDocstring ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( <EOL> self . shortDescription ( ) , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def testAddTypeEqualityFunc ( self ) : <EOL> class SadSnake ( object ) : <EOL> """<STR_LIT>""" <EOL> s1 , s2 = SadSnake ( ) , SadSnake ( ) <EOL> self . assertNotEqual ( s1 , s2 ) <EOL> def AllSnakesCreatedEqual ( a , b , msg = None ) : <EOL> return type ( a ) is type ( b ) is SadSnake <EOL> self . addTypeEqualityFunc ( SadSnake , AllSnakesCreatedEqual ) <EOL> self . assertEqual ( s1 , s2 ) <EOL> def testAssertIs ( self ) : <EOL> thing = object ( ) <EOL> self . assertIs ( thing , thing ) <EOL> self . assertRaises ( self . failureException , self . assertIs , thing , object ( ) ) <EOL> def testAssertIsNot ( self ) : <EOL> thing = object ( ) <EOL> self . assertIsNot ( thing , object ( ) ) <EOL> self . assertRaises ( self . failureException , self . assertIsNot , thing , thing ) <EOL> def testAssertIsInstance ( self ) : <EOL> thing = [ ] <EOL> self . assertIsInstance ( thing , list ) <EOL> self . assertRaises ( self . failureException , self . assertIsInstance , <EOL> thing , dict ) <EOL> def testAssertNotIsInstance ( self ) : <EOL> thing = [ ] <EOL> self . assertNotIsInstance ( thing , dict ) <EOL> self . assertRaises ( self . failureException , self . assertNotIsInstance , <EOL> thing , list ) <EOL> def testAssertIn ( self ) : <EOL> animals = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> self . assertIn ( '<STR_LIT:a>' , '<STR_LIT:abc>' ) <EOL> self . assertIn ( <NUM_LIT:2> , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> self . assertIn ( '<STR_LIT>' , animals ) <EOL> self . assertNotIn ( '<STR_LIT:d>' , '<STR_LIT:abc>' ) <EOL> self . assertNotIn ( <NUM_LIT:0> , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> self . assertNotIn ( '<STR_LIT>' , animals ) <EOL> self . assertRaises ( self . failureException , self . assertIn , '<STR_LIT:x>' , '<STR_LIT:abc>' ) <EOL> self . assertRaises ( self . failureException , self . assertIn , <NUM_LIT:4> , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> self . assertRaises ( self . failureException , self . assertIn , '<STR_LIT>' , <EOL> animals ) <EOL> self . assertRaises ( self . failureException , self . assertNotIn , '<STR_LIT:c>' , '<STR_LIT:abc>' ) <EOL> self . assertRaises ( self . failureException , self . assertNotIn , <NUM_LIT:1> , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> self . assertRaises ( self . failureException , self . assertNotIn , '<STR_LIT>' , <EOL> animals ) <EOL> def testAssertDictContainsSubset ( self ) : <EOL> self . assertDictContainsSubset ( { } , { } ) <EOL> self . assertDictContainsSubset ( { } , { '<STR_LIT:a>' : <NUM_LIT:1> } ) <EOL> self . assertDictContainsSubset ( { '<STR_LIT:a>' : <NUM_LIT:1> } , { '<STR_LIT:a>' : <NUM_LIT:1> } ) <EOL> self . assertDictContainsSubset ( { '<STR_LIT:a>' : <NUM_LIT:1> } , { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:b>' : <NUM_LIT:2> } ) <EOL> self . assertDictContainsSubset ( { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:b>' : <NUM_LIT:2> } , { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:b>' : <NUM_LIT:2> } ) <EOL> self . assertRaises ( unittest2 . TestCase . failureException , <EOL> self . assertDictContainsSubset , { '<STR_LIT:a>' : <NUM_LIT:2> } , { '<STR_LIT:a>' : <NUM_LIT:1> } , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( unittest2 . TestCase . failureException , <EOL> self . assertDictContainsSubset , { '<STR_LIT:c>' : <NUM_LIT:1> } , { '<STR_LIT:a>' : <NUM_LIT:1> } , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( unittest2 . TestCase . failureException , <EOL> self . assertDictContainsSubset , { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:c>' : <NUM_LIT:1> } , <EOL> { '<STR_LIT:a>' : <NUM_LIT:1> } , '<STR_LIT>' ) <EOL> self . assertRaises ( unittest2 . TestCase . failureException , <EOL> self . assertDictContainsSubset , { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:c>' : <NUM_LIT:1> } , <EOL> { '<STR_LIT:a>' : <NUM_LIT:1> } , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , <EOL> self . assertDictContainsSubset , { <NUM_LIT:1> : "<STR_LIT>" } , { } ) <EOL> def testAssertEqual ( self ) : <EOL> equal_pairs = [ <EOL> ( ( ) , ( ) ) , <EOL> ( { } , { } ) , <EOL> ( [ ] , [ ] ) , <EOL> ( set ( ) , set ( ) ) , <EOL> ( frozenset ( ) , frozenset ( ) ) ] <EOL> for a , b in equal_pairs : <EOL> try : <EOL> self . assertEqual ( a , b ) <EOL> except self . failureException : <EOL> self . fail ( '<STR_LIT>' % ( a , b ) ) <EOL> try : <EOL> self . assertEqual ( a , b , msg = '<STR_LIT:foo>' ) <EOL> except self . failureException : <EOL> self . fail ( '<STR_LIT>' % ( a , b ) ) <EOL> try : <EOL> self . assertEqual ( a , b , '<STR_LIT:foo>' ) <EOL> except self . failureException : <EOL> self . fail ( '<STR_LIT>' % <EOL> ( a , b ) ) <EOL> unequal_pairs = [ <EOL> ( ( ) , [ ] ) , <EOL> ( { } , set ( ) ) , <EOL> ( set ( [ <NUM_LIT:4> , <NUM_LIT:1> ] ) , frozenset ( [ <NUM_LIT:4> , <NUM_LIT:2> ] ) ) , <EOL> ( frozenset ( [ <NUM_LIT:4> , <NUM_LIT:5> ] ) , set ( [ <NUM_LIT:2> , <NUM_LIT:3> ] ) ) , <EOL> ( set ( [ <NUM_LIT:3> , <NUM_LIT:4> ] ) , set ( [ <NUM_LIT:5> , <NUM_LIT:4> ] ) ) ] <EOL> for a , b in unequal_pairs : <EOL> self . assertRaises ( self . failureException , self . assertEqual , a , b ) <EOL> self . assertRaises ( self . failureException , self . assertEqual , a , b , <EOL> '<STR_LIT:foo>' ) <EOL> self . assertRaises ( self . failureException , self . assertEqual , a , b , <EOL> msg = '<STR_LIT:foo>' ) <EOL> def testEquality ( self ) : <EOL> self . assertListEqual ( [ ] , [ ] ) <EOL> self . assertTupleEqual ( ( ) , ( ) ) <EOL> self . assertSequenceEqual ( [ ] , ( ) ) <EOL> a = [ <NUM_LIT:0> , '<STR_LIT:a>' , [ ] ] <EOL> b = [ ] <EOL> self . assertRaises ( unittest2 . TestCase . failureException , <EOL> self . assertListEqual , a , b ) <EOL> self . assertRaises ( unittest2 . TestCase . failureException , <EOL> self . assertListEqual , tuple ( a ) , tuple ( b ) ) <EOL> self . assertRaises ( unittest2 . TestCase . failureException , <EOL> self . assertSequenceEqual , a , tuple ( b ) ) <EOL> b . extend ( a ) <EOL> self . assertListEqual ( a , b ) <EOL> self . assertTupleEqual ( tuple ( a ) , tuple ( b ) ) <EOL> self . assertSequenceEqual ( a , tuple ( b ) ) <EOL> self . assertSequenceEqual ( tuple ( a ) , b ) <EOL> self . assertRaises ( self . failureException , self . assertListEqual , <EOL> a , tuple ( b ) ) <EOL> self . assertRaises ( self . failureException , self . assertTupleEqual , <EOL> tuple ( a ) , b ) <EOL> self . assertRaises ( self . failureException , self . assertListEqual , None , b ) <EOL> self . assertRaises ( self . failureException , self . assertTupleEqual , None , <EOL> tuple ( b ) ) <EOL> self . assertRaises ( self . failureException , self . assertSequenceEqual , <EOL> None , tuple ( b ) ) <EOL> self . assertRaises ( self . failureException , self . assertListEqual , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . assertRaises ( self . failureException , self . assertTupleEqual , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . assertRaises ( self . failureException , self . assertSequenceEqual , <EOL> <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . assertDictEqual ( { } , { } ) <EOL> c = { '<STR_LIT:x>' : <NUM_LIT:1> } <EOL> d = { } <EOL> self . assertRaises ( unittest2 . TestCase . failureException , <EOL> self . assertDictEqual , c , d ) <EOL> d . update ( c ) <EOL> self . assertDictEqual ( c , d ) <EOL> d [ '<STR_LIT:x>' ] = <NUM_LIT:0> <EOL> self . assertRaises ( unittest2 . TestCase . failureException , <EOL> self . assertDictEqual , c , d , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertDictEqual , None , d ) <EOL> self . assertRaises ( self . failureException , self . assertDictEqual , [ ] , d ) <EOL> self . assertRaises ( self . failureException , self . assertDictEqual , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> def testAssertItemsEqual ( self ) : <EOL> self . assertItemsEqual ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , [ <NUM_LIT:3> , <NUM_LIT:2> , <NUM_LIT:1> ] ) <EOL> self . assertItemsEqual ( [ '<STR_LIT:foo>' , '<STR_LIT:bar>' , '<STR_LIT>' ] , [ '<STR_LIT:bar>' , '<STR_LIT>' , '<STR_LIT:foo>' ] ) <EOL> self . assertRaises ( self . failureException , self . assertItemsEqual , <EOL> [ <NUM_LIT:10> ] , [ <NUM_LIT:10> , <NUM_LIT:11> ] ) <EOL> self . assertRaises ( self . failureException , self . assertItemsEqual , <EOL> [ <NUM_LIT:10> , <NUM_LIT:11> ] , [ <NUM_LIT:10> ] ) <EOL> self . assertRaises ( self . failureException , self . assertItemsEqual , <EOL> [ <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:10> ] , [ <NUM_LIT:10> , <NUM_LIT:11> ] ) <EOL> self . assertItemsEqual ( [ [ <NUM_LIT:1> , <NUM_LIT:2> ] , [ <NUM_LIT:3> , <NUM_LIT:4> ] ] , [ [ <NUM_LIT:3> , <NUM_LIT:4> ] , [ <NUM_LIT:1> , <NUM_LIT:2> ] ] ) <EOL> self . assertItemsEqual ( [ { '<STR_LIT:a>' : <NUM_LIT:1> } , { '<STR_LIT:b>' : <NUM_LIT:2> } ] , [ { '<STR_LIT:b>' : <NUM_LIT:2> } , { '<STR_LIT:a>' : <NUM_LIT:1> } ] ) <EOL> self . assertRaises ( self . failureException , self . assertItemsEqual , <EOL> [ [ <NUM_LIT:1> ] ] , [ [ <NUM_LIT:2> ] ] ) <EOL> self . assertItemsEqual ( [ <NUM_LIT> , None ] , [ None , <NUM_LIT> ] ) <EOL> self . assertRaises ( self . failureException , self . assertItemsEqual , <EOL> [ <NUM_LIT> , None ] , [ None , <NUM_LIT> ] ) <EOL> def testAssertSetEqual ( self ) : <EOL> set1 = set ( ) <EOL> set2 = set ( ) <EOL> self . assertSetEqual ( set1 , set2 ) <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , None , set2 ) <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , [ ] , set2 ) <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , set1 , None ) <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , set1 , [ ] ) <EOL> set1 = set ( [ '<STR_LIT:a>' ] ) <EOL> set2 = set ( ) <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , set1 , set2 ) <EOL> set1 = set ( [ '<STR_LIT:a>' ] ) <EOL> set2 = set ( [ '<STR_LIT:a>' ] ) <EOL> self . assertSetEqual ( set1 , set2 ) <EOL> set1 = set ( [ '<STR_LIT:a>' ] ) <EOL> set2 = set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , set1 , set2 ) <EOL> set1 = set ( [ '<STR_LIT:a>' ] ) <EOL> set2 = frozenset ( [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , set1 , set2 ) <EOL> set1 = set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> set2 = frozenset ( [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> self . assertSetEqual ( set1 , set2 ) <EOL> set1 = set ( ) <EOL> set2 = "<STR_LIT:foo>" <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , set1 , set2 ) <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , set2 , set1 ) <EOL> set1 = set ( [ ( <NUM_LIT:0> , <NUM_LIT:1> ) , ( <NUM_LIT:2> , <NUM_LIT:3> ) ] ) <EOL> set2 = set ( [ ( <NUM_LIT:4> , <NUM_LIT:5> ) ] ) <EOL> self . assertRaises ( self . failureException , self . assertSetEqual , set1 , set2 ) <EOL> def testInequality ( self ) : <EOL> self . assertGreater ( <NUM_LIT:2> , <NUM_LIT:1> ) <EOL> self . assertGreaterEqual ( <NUM_LIT:2> , <NUM_LIT:1> ) <EOL> self . assertGreaterEqual ( <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . assertLess ( <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> self . assertLessEqual ( <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> self . assertLessEqual ( <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . assertRaises ( self . failureException , self . assertGreaterEqual , <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> self . assertRaises ( self . failureException , self . assertLess , <NUM_LIT:2> , <NUM_LIT:1> ) <EOL> self . assertRaises ( self . failureException , self . assertLess , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . assertRaises ( self . failureException , self . assertLessEqual , <NUM_LIT:2> , <NUM_LIT:1> ) <EOL> self . assertGreater ( <NUM_LIT> , <NUM_LIT:1.0> ) <EOL> self . assertGreaterEqual ( <NUM_LIT> , <NUM_LIT:1.0> ) <EOL> self . assertGreaterEqual ( <NUM_LIT:1.0> , <NUM_LIT:1.0> ) <EOL> self . assertLess ( <NUM_LIT:1.0> , <NUM_LIT> ) <EOL> self . assertLessEqual ( <NUM_LIT:1.0> , <NUM_LIT> ) <EOL> self . assertLessEqual ( <NUM_LIT:1.0> , <NUM_LIT:1.0> ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , <NUM_LIT:1.0> , <NUM_LIT> ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , <NUM_LIT:1.0> , <NUM_LIT:1.0> ) <EOL> self . assertRaises ( self . failureException , self . assertGreaterEqual , <NUM_LIT:1.0> , <NUM_LIT> ) <EOL> self . assertRaises ( self . failureException , self . assertLess , <NUM_LIT> , <NUM_LIT:1.0> ) <EOL> self . assertRaises ( self . failureException , self . assertLess , <NUM_LIT:1.0> , <NUM_LIT:1.0> ) <EOL> self . assertRaises ( self . failureException , self . assertLessEqual , <NUM_LIT> , <NUM_LIT:1.0> ) <EOL> self . assertGreater ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertGreaterEqual ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertGreaterEqual ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertLess ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertLessEqual ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertLessEqual ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreaterEqual , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLess , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLess , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLessEqual , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertGreater ( u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertGreaterEqual ( u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertGreaterEqual ( u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertLess ( u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertLessEqual ( u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertLessEqual ( u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreaterEqual , u'<STR_LIT>' , <EOL> u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLess , u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLess , u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLessEqual , u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertGreater ( '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertGreater ( u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertGreaterEqual ( '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertGreaterEqual ( u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertGreaterEqual ( '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertGreaterEqual ( u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertLess ( '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertLess ( u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertLessEqual ( '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertLessEqual ( u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertLessEqual ( '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertLessEqual ( u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreater , u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreaterEqual , '<STR_LIT>' , <EOL> u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertGreaterEqual , u'<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLess , '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLess , u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLess , '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLess , u'<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLessEqual , '<STR_LIT>' , u'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertLessEqual , u'<STR_LIT>' , '<STR_LIT>' ) <EOL> def testAssertMultiLineEqual ( self ) : <EOL> sample_text = """<STR_LIT>""" <EOL> revised_sample_text = """<STR_LIT>""" <EOL> sample_text_error = """<STR_LIT>""" <EOL> self . maxDiff = None <EOL> for type_changer in ( lambda x : x , lambda x : x . decode ( '<STR_LIT:utf8>' ) ) : <EOL> try : <EOL> self . assertMultiLineEqual ( type_changer ( sample_text ) , <EOL> type_changer ( revised_sample_text ) ) <EOL> except self . failureException , e : <EOL> error = str ( e ) . encode ( '<STR_LIT:utf8>' ) . split ( '<STR_LIT:\n>' , <NUM_LIT:1> ) [ <NUM_LIT:1> ] <EOL> self . assertTrue ( sample_text_error == error ) <EOL> def testAssertSequenceEqualMaxDiff ( self ) : <EOL> self . assertEqual ( self . maxDiff , <NUM_LIT> * <NUM_LIT:8> ) <EOL> seq1 = '<STR_LIT:a>' + '<STR_LIT:x>' * <NUM_LIT> ** <NUM_LIT:2> <EOL> seq2 = '<STR_LIT:b>' + '<STR_LIT:x>' * <NUM_LIT> ** <NUM_LIT:2> <EOL> diff = '<STR_LIT:\n>' . join ( difflib . ndiff ( pprint . pformat ( seq1 ) . splitlines ( ) , <EOL> pprint . pformat ( seq2 ) . splitlines ( ) ) ) <EOL> omitted = unittest2 . case . DIFF_OMITTED % ( len ( diff ) + <NUM_LIT:1> , ) <EOL> self . maxDiff = len ( diff ) // <NUM_LIT:2> <EOL> try : <EOL> self . assertSequenceEqual ( seq1 , seq2 ) <EOL> except self . failureException , e : <EOL> msg = e . args [ <NUM_LIT:0> ] <EOL> else : <EOL> self . fail ( '<STR_LIT>' ) <EOL> self . assertTrue ( len ( msg ) < len ( diff ) ) <EOL> self . assertIn ( omitted , msg ) <EOL> self . maxDiff = len ( diff ) * <NUM_LIT:2> <EOL> try : <EOL> self . assertSequenceEqual ( seq1 , seq2 ) <EOL> except self . failureException , e : <EOL> msg = e . args [ <NUM_LIT:0> ] <EOL> else : <EOL> self . fail ( '<STR_LIT>' ) <EOL> self . assertTrue ( len ( msg ) > len ( diff ) ) <EOL> self . assertNotIn ( omitted , msg ) <EOL> self . maxDiff = None <EOL> try : <EOL> self . assertSequenceEqual ( seq1 , seq2 ) <EOL> except self . failureException , e : <EOL> msg = e . args [ <NUM_LIT:0> ] <EOL> else : <EOL> self . fail ( '<STR_LIT>' ) <EOL> self . assertTrue ( len ( msg ) > len ( diff ) ) <EOL> self . assertNotIn ( omitted , msg ) <EOL> def testTruncateMessage ( self ) : <EOL> self . maxDiff = <NUM_LIT:1> <EOL> message = self . _truncateMessage ( '<STR_LIT:foo>' , '<STR_LIT:bar>' ) <EOL> omitted = unittest2 . case . DIFF_OMITTED % len ( '<STR_LIT:bar>' ) <EOL> self . assertEqual ( message , '<STR_LIT:foo>' + omitted ) <EOL> self . maxDiff = None <EOL> message = self . _truncateMessage ( '<STR_LIT:foo>' , '<STR_LIT:bar>' ) <EOL> self . assertEqual ( message , '<STR_LIT>' ) <EOL> self . maxDiff = <NUM_LIT:4> <EOL> message = self . _truncateMessage ( '<STR_LIT:foo>' , '<STR_LIT:bar>' ) <EOL> self . assertEqual ( message , '<STR_LIT>' ) <EOL> def testAssertDictEqualTruncates ( self ) : <EOL> test = unittest2 . TestCase ( '<STR_LIT>' ) <EOL> def truncate ( msg , diff ) : <EOL> return '<STR_LIT:foo>' <EOL> test . _truncateMessage = truncate <EOL> try : <EOL> test . assertDictEqual ( { } , { <NUM_LIT:1> : <NUM_LIT:0> } ) <EOL> except self . failureException , e : <EOL> self . assertEqual ( str ( e ) , '<STR_LIT:foo>' ) <EOL> else : <EOL> self . fail ( '<STR_LIT>' ) <EOL> def testAssertMultiLineEqualTruncates ( self ) : <EOL> test = unittest2 . TestCase ( '<STR_LIT>' ) <EOL> def truncate ( msg , diff ) : <EOL> return '<STR_LIT:foo>' <EOL> test . _truncateMessage = truncate <EOL> try : <EOL> test . assertMultiLineEqual ( '<STR_LIT:foo>' , '<STR_LIT:bar>' ) <EOL> except self . failureException , e : <EOL> self . assertEqual ( str ( e ) , '<STR_LIT:foo>' ) <EOL> else : <EOL> self . fail ( '<STR_LIT>' ) <EOL> def testAssertIsNone ( self ) : <EOL> self . assertIsNone ( None ) <EOL> self . assertRaises ( self . failureException , self . assertIsNone , False ) <EOL> self . assertIsNotNone ( '<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertIsNotNone , None ) <EOL> def testAssertRegexpMatches ( self ) : <EOL> self . assertRegexpMatches ( '<STR_LIT>' , r'<STR_LIT>' ) <EOL> self . assertRaises ( self . failureException , self . assertRegexpMatches , <EOL> '<STR_LIT>' , r'<STR_LIT>' ) <EOL> def testAssertRaisesRegexp ( self ) : <EOL> class ExceptionMock ( Exception ) : <EOL> pass <EOL> def Stub ( ) : <EOL> raise ExceptionMock ( '<STR_LIT>' ) <EOL> self . assertRaisesRegexp ( ExceptionMock , re . compile ( '<STR_LIT>' ) , Stub ) <EOL> self . assertRaisesRegexp ( ExceptionMock , '<STR_LIT>' , Stub ) <EOL> self . assertRaisesRegexp ( ExceptionMock , u'<STR_LIT>' , Stub ) <EOL> def testAssertNotRaisesRegexp ( self ) : <EOL> self . assertRaisesRegexp ( <EOL> self . failureException , '<STR_LIT>' , <EOL> self . assertRaisesRegexp , Exception , re . compile ( '<STR_LIT:x>' ) , <EOL> lambda : None ) <EOL> self . assertRaisesRegexp ( <EOL> self . failureException , '<STR_LIT>' , <EOL> self . assertRaisesRegexp , Exception , '<STR_LIT:x>' , <EOL> lambda : None ) <EOL> self . assertRaisesRegexp ( <EOL> self . failureException , '<STR_LIT>' , <EOL> self . assertRaisesRegexp , Exception , u'<STR_LIT:x>' , <EOL> lambda : None ) <EOL> def testAssertRaisesRegexpMismatch ( self ) : <EOL> def Stub ( ) : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> self . assertRaisesRegexp ( <EOL> self . failureException , <EOL> r'<STR_LIT>' , <EOL> self . assertRaisesRegexp , Exception , '<STR_LIT>' , <EOL> Stub ) <EOL> self . assertRaisesRegexp ( <EOL> self . failureException , <EOL> r'<STR_LIT>' , <EOL> self . assertRaisesRegexp , Exception , u'<STR_LIT>' , <EOL> Stub ) <EOL> self . assertRaisesRegexp ( <EOL> self . failureException , <EOL> r'<STR_LIT>' , <EOL> self . assertRaisesRegexp , Exception , <EOL> re . compile ( '<STR_LIT>' ) , Stub ) <EOL> def testSynonymAssertMethodNames ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertNotEquals ( <NUM_LIT:3> , <NUM_LIT:5> ) <EOL> self . assertEquals ( <NUM_LIT:3> , <NUM_LIT:3> ) <EOL> self . assertAlmostEquals ( <NUM_LIT> , <NUM_LIT> ) <EOL> self . assertNotAlmostEquals ( <NUM_LIT> , <NUM_LIT> ) <EOL> self . assert_ ( True ) <EOL> def testDeepcopy ( self ) : <EOL> class TestableTest ( unittest2 . TestCase ) : <EOL> def testNothing ( self ) : <EOL> pass <EOL> test = TestableTest ( '<STR_LIT>' ) <EOL> deepcopy ( test ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest2 . main ( ) </s>
