Showing content from http://svn.python.org/projects/python/branches/r23b2-branch/Lib/test/test_syntax.py below:
import re import unittest from test import test_support class SyntaxTestCase(unittest.TestCase): def _check_error(self, code, errtext, filename=" ", mode="exec"): """Check that compiling code raises SyntaxError with errtext. errtest is a regular expression that must be present in the test of the exception raised. """ try: compile(code, filename, mode) except SyntaxError, err: mo = re.search(errtext, str(err)) if mo is None: self.fail("SyntaxError did not contain '%s'" % `errtext`) else: self.fail("compile() did not raise SyntaxError") def test_assign_call(self): self._check_error("f() = 1", "assign") def test_assign_del(self): self._check_error("del f()", "delete") def test_main(): test_support.run_unittest(SyntaxTestCase) if __name__ == "__main__": test_main()
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4