diff options
author | Larry Hastings <larry@hastings.org> | 2014-01-16 22:15:03 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-01-16 22:15:03 (GMT) |
commit | 1abd708681d9425b113366ac3f3d734c2904b250 (patch) | |
tree | 1b508617aaac737586b71ab8102367721d707a3f /Tools/clinic | |
parent | 2a727916c598c576507e3a7447fc54cc0e01d4a5 (diff) | |
download | cpython-1abd708681d9425b113366ac3f3d734c2904b250.zip cpython-1abd708681d9425b113366ac3f3d734c2904b250.tar.gz cpython-1abd708681d9425b113366ac3f3d734c2904b250.tar.bz2 |
Issue #20226: Added tests for new features and regressions.
Diffstat (limited to 'Tools/clinic')
-rw-r--r-- | Tools/clinic/clinic_test.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Tools/clinic/clinic_test.py b/Tools/clinic/clinic_test.py index 7de5429..6472527 100644 --- a/Tools/clinic/clinic_test.py +++ b/Tools/clinic/clinic_test.py @@ -9,6 +9,7 @@ from clinic import DSLParser import collections import inspect from test import support +import sys import unittest from unittest import TestCase @@ -277,6 +278,20 @@ class ClinicParserTest(TestCase): p = function.parameters['follow_symlinks'] self.assertEqual(True, p.default) + def test_param_with_continuations(self): + function = self.parse_function("module os\nos.access\n follow_symlinks: \\\n bool \\\n =\\\n True") + p = function.parameters['follow_symlinks'] + self.assertEqual(True, p.default) + + def test_param_default_expression(self): + function = self.parse_function("module os\nos.access\n follow_symlinks: int(c_default='MAXSIZE') = sys.maxsize") + p = function.parameters['follow_symlinks'] + self.assertEqual(sys.maxsize, p.default) + self.assertEqual("MAXSIZE", p.converter.c_default) + + s = self.parse_function_should_fail("module os\nos.access\n follow_symlinks: int = sys.maxsize") + self.assertEqual(s, "Error on line 0:\nWhen you specify a named constant ('sys.maxsize') as your default value,\nyou MUST specify a valid c_default.\n") + def test_param_no_docstring(self): function = self.parse_function(""" module os |