def test_compile_filename(self):
    for filename in ('file.py', b'file.py'):
        code = compile('pass', filename, 'exec')
        self.assertEqual(code.co_filename, 'file.py')
    for filename in (bytearray(b'file.py'), memoryview(b'file.py')):
        with self.assertWarns(DeprecationWarning):
            code = compile('pass', filename, 'exec')
        self.assertEqual(code.co_filename, 'file.py')
    self.assertRaises(TypeError, compile, 'pass', list(b'file.py'), 'exec')
def test_compile_filename(self):
    for filename in ('file.py', b'file.py'):
        code = compile('pass', filename, 'exec')
        self.assertEqual(code.co_filename, 'file.py')
    for filename in (bytearray(b'file.py'), memoryview(b'file.py')):
        with self.assertWarns(DeprecationWarning):
            code = compile('pass', filename, 'exec')
        self.assertEqual(code.co_filename, 'file.py')
    self.assertRaises(TypeError, compile, 'pass', list(b'file.py'), 'exec')