def test_bad_syntax(self):
    with util.create_modules('_temp') as mapping:
        with open(mapping['_temp'], 'w') as file:
            file.write('=')
        loader = self.machinery.SourceFileLoader('_temp', mapping['_temp'])
        with self.assertRaises(SyntaxError):
            with warnings.catch_warnings():
                warnings.simplefilter('ignore', DeprecationWarning)
                loader.load_module('_temp')
        self.assertNotIn('_temp', sys.modules)
def test_bad_syntax(self):
    with util.create_modules('_temp') as mapping:
        with open(mapping['_temp'], 'w') as file:
            file.write('=')
        loader = self.machinery.SourceFileLoader('_temp', mapping['_temp'])
        with self.assertRaises(SyntaxError):
            with warnings.catch_warnings():
                warnings.simplefilter('ignore', DeprecationWarning)
                loader.load_module('_temp')
        self.assertNotIn('_temp', sys.modules)