mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #20226: Added tests for new features and regressions.
This commit is contained in:
parent
2a727916c5
commit
1abd708681
2 changed files with 20 additions and 0 deletions
|
@ -689,6 +689,11 @@ class TestDescriptions(unittest.TestCase):
|
||||||
self.assertIsNone(pydoc.locate(name))
|
self.assertIsNone(pydoc.locate(name))
|
||||||
self.assertRaises(ImportError, pydoc.render_doc, name)
|
self.assertRaises(ImportError, pydoc.render_doc, name)
|
||||||
|
|
||||||
|
# test producing signatures from builtins
|
||||||
|
stat_sig = pydoc.render_doc(os.stat)
|
||||||
|
self.assertEqual(pydoc.plain(stat_sig).splitlines()[2],
|
||||||
|
'stat(path, *, dir_fd=None, follow_symlinks=True)')
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(threading, 'Threading required for this test.')
|
@unittest.skipUnless(threading, 'Threading required for this test.')
|
||||||
class PydocServerTest(unittest.TestCase):
|
class PydocServerTest(unittest.TestCase):
|
||||||
|
|
|
@ -9,6 +9,7 @@ from clinic import DSLParser
|
||||||
import collections
|
import collections
|
||||||
import inspect
|
import inspect
|
||||||
from test import support
|
from test import support
|
||||||
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
@ -277,6 +278,20 @@ class ClinicParserTest(TestCase):
|
||||||
p = function.parameters['follow_symlinks']
|
p = function.parameters['follow_symlinks']
|
||||||
self.assertEqual(True, p.default)
|
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):
|
def test_param_no_docstring(self):
|
||||||
function = self.parse_function("""
|
function = self.parse_function("""
|
||||||
module os
|
module os
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue