<s> import os <EOL> import sys <EOL> import json <EOL> import doctest <EOL> import unittest <EOL> from test import support <EOL> cjson = support . import_fresh_module ( '<STR_LIT>' , fresh = [ '<STR_LIT>' ] ) <EOL> pyjson = support . import_fresh_module ( '<STR_LIT>' , blocked = [ '<STR_LIT>' ] ) <EOL> class PyTest ( unittest . TestCase ) : <EOL> json = pyjson <EOL> loads = staticmethod ( pyjson . loads ) <EOL> dumps = staticmethod ( pyjson . dumps ) <EOL> @ unittest . skipUnless ( cjson , '<STR_LIT>' ) <EOL> class CTest ( unittest . TestCase ) : <EOL> if cjson is not None : <EOL> json = cjson <EOL> loads = staticmethod ( cjson . loads ) <EOL> dumps = staticmethod ( cjson . dumps ) <EOL> class TestPyTest ( PyTest ) : <EOL> def test_pyjson ( self ) : <EOL> self . assertEqual ( self . json . scanner . make_scanner . __module__ , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( self . json . decoder . scanstring . __module__ , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( self . json . encoder . encode_basestring_ascii . __module__ , <EOL> '<STR_LIT>' ) <EOL> class TestCTest ( CTest ) : <EOL> def test_cjson ( self ) : <EOL> self . assertEqual ( self . json . scanner . make_scanner . __module__ , '<STR_LIT>' ) <EOL> self . assertEqual ( self . json . decoder . scanstring . __module__ , '<STR_LIT>' ) <EOL> self . assertEqual ( self . json . encoder . c_make_encoder . __module__ , '<STR_LIT>' ) <EOL> self . assertEqual ( self . json . encoder . encode_basestring_ascii . __module__ , <EOL> '<STR_LIT>' ) <EOL> here = os . path . dirname ( __file__ ) <EOL> def load_tests ( * args ) : <EOL> suite = additional_tests ( ) <EOL> loader = unittest . TestLoader ( ) <EOL> for fn in os . listdir ( here ) : <EOL> if fn . startswith ( "<STR_LIT:test>" ) and fn . endswith ( "<STR_LIT>" ) : <EOL> modname = "<STR_LIT>" + fn [ : - <NUM_LIT:3> ] <EOL> __import__ ( modname ) <EOL> module = sys . modules [ modname ] <EOL> suite . addTests ( loader . loadTestsFromModule ( module ) ) <EOL> return suite <EOL> def additional_tests ( ) : <EOL> suite = unittest . TestSuite ( ) <EOL> for mod in ( json , json . encoder , json . decoder ) : <EOL> suite . addTest ( doctest . DocTestSuite ( mod ) ) <EOL> suite . addTest ( TestPyTest ( '<STR_LIT>' ) ) <EOL> suite . addTest ( TestCTest ( '<STR_LIT>' ) ) <EOL> return suite </s>
