summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_coding.py
blob: aa7241d947045eba2e7ed6b734ad28c520a80be6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

import test.test_support, unittest
import os

class CodingTest(unittest.TestCase):
    def test_bad_coding(self):
        module_name = 'bad_coding'
        self.assertRaises(SyntaxError, __import__, 'test.' + module_name)

        path = os.path.dirname(__file__)
        filename = os.path.join(path, module_name + '.py')
        fp = open(filename)
        text = fp.read()
        fp.close()
        self.assertRaises(SyntaxError, compile, text, filename, 'exec')

def test_main():
    test.test_support.run_unittest(CodingTest)

if __name__ == "__main__":
    test_main()