~malept/ubuntu/lucid/python2.6/dev-dependency-fix

« back to all changes in this revision

Viewing changes to Lib/test/test_coding.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-02-13 12:51:00 UTC
  • Revision ID: james.westby@ubuntu.com-20090213125100-uufgcb9yeqzujpqw
Tags: upstream-2.6.1
ImportĀ upstreamĀ versionĀ 2.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
import test.test_support, unittest
 
3
import os
 
4
 
 
5
class CodingTest(unittest.TestCase):
 
6
    def test_bad_coding(self):
 
7
        module_name = 'bad_coding'
 
8
        self.verify_bad_module(module_name)
 
9
 
 
10
    def test_bad_coding2(self):
 
11
        module_name = 'bad_coding2'
 
12
        self.verify_bad_module(module_name)
 
13
 
 
14
    def verify_bad_module(self, module_name):
 
15
        self.assertRaises(SyntaxError, __import__, 'test.' + module_name)
 
16
 
 
17
        path = os.path.dirname(__file__)
 
18
        filename = os.path.join(path, module_name + '.py')
 
19
        fp = open(filename)
 
20
        text = fp.read()
 
21
        fp.close()
 
22
        self.assertRaises(SyntaxError, compile, text, filename, 'exec')
 
23
 
 
24
def test_main():
 
25
    test.test_support.run_unittest(CodingTest)
 
26
 
 
27
if __name__ == "__main__":
 
28
    test_main()