<s> import logging <EOL> import sys <EOL> from wakadump . compat import u <EOL> try : <EOL> import mock <EOL> except ImportError : <EOL> import unittest . mock as mock <EOL> try : <EOL> import unittest2 as unittest <EOL> except ImportError : <EOL> import unittest <EOL> class TestCase ( unittest . TestCase ) : <EOL> patch_these = [ ] <EOL> def setUp ( self ) : <EOL> logging . disable ( logging . CRITICAL ) <EOL> self . patched = { } <EOL> if hasattr ( self , '<STR_LIT>' ) : <EOL> for patch_this in self . patch_these : <EOL> namespace = patch_this [ <NUM_LIT:0> ] if isinstance ( patch_this , ( list , set ) ) else patch_this <EOL> patcher = mock . patch ( namespace ) <EOL> mocked = patcher . start ( ) <EOL> mocked . reset_mock ( ) <EOL> self . patched [ namespace ] = mocked <EOL> if isinstance ( patch_this , ( list , set ) ) and len ( patch_this ) > <NUM_LIT:0> : <EOL> retval = patch_this [ <NUM_LIT:1> ] <EOL> if callable ( retval ) : <EOL> retval = retval ( ) <EOL> mocked . return_value = retval <EOL> def tearDown ( self ) : <EOL> mock . patch . stopall ( ) <EOL> def normalize_list ( self , items ) : <EOL> return sorted ( [ u ( x ) for x in items ] ) <EOL> def assertListsEqual ( self , first_list , second_list ) : <EOL> self . assertEquals ( self . normalize_list ( first_list ) , self . normalize_list ( second_list ) ) <EOL> @ property <EOL> def isPy35 ( self ) : <EOL> return ( sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:3> and sys . version_info [ <NUM_LIT:1> ] == <NUM_LIT:5> ) </s>
