<s> import re , doctest , unittest <EOL> from django . db import transaction <EOL> from django . core import management <EOL> from django . db . models import get_apps <EOL> normalize_long_ints = lambda s : re . sub ( r'<STR_LIT>' , '<STR_LIT>' , s ) <EOL> class OutputChecker ( doctest . OutputChecker ) : <EOL> def check_output ( self , want , got , optionflags ) : <EOL> ok = doctest . OutputChecker . check_output ( self , want , got , optionflags ) <EOL> if not ok : <EOL> return normalize_long_ints ( want ) == normalize_long_ints ( got ) <EOL> return ok <EOL> class DocTestRunner ( doctest . DocTestRunner ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> doctest . DocTestRunner . __init__ ( self , * args , ** kwargs ) <EOL> self . optionflags = doctest . ELLIPSIS <EOL> def report_unexpected_exception ( self , out , test , example , exc_info ) : <EOL> doctest . DocTestRunner . report_unexpected_exception ( self , out , test , example , exc_info ) <EOL> from django . db import transaction <EOL> transaction . rollback_unless_managed ( ) <EOL> class TestCase ( unittest . TestCase ) : <EOL> def install_fixtures ( self ) : <EOL> """<STR_LIT>""" <EOL> management . flush ( verbosity = <NUM_LIT:0> , interactive = False ) <EOL> if hasattr ( self , '<STR_LIT>' ) : <EOL> management . load_data ( self . fixtures , verbosity = <NUM_LIT:0> ) <EOL> def run ( self , result = None ) : <EOL> """<STR_LIT>""" <EOL> self . install_fixtures ( ) <EOL> super ( TestCase , self ) . run ( result ) </s>
