Title: Doctest fails in `stdtypes.rst` · Issue #106446 · python/cpython · GitHub
Open Graph Title: Doctest fails in `stdtypes.rst` · Issue #106446 · python/cpython
X Title: Doctest fails in `stdtypes.rst` · Issue #106446 · python/cpython
Description: Documentation When some codes are modified, the doc and doctests are not updated synchronously. Local doctest: ./python -m doctest ./Doc/library/stdtypes.rst Details ********************************************************************** ...
Open Graph Description: Documentation When some codes are modified, the doc and doctests are not updated synchronously. Local doctest: ./python -m doctest ./Doc/library/stdtypes.rst Details *******************************...
X Description: Documentation When some codes are modified, the doc and doctests are not updated synchronously. Local doctest: ./python -m doctest ./Doc/library/stdtypes.rst Details *******************************...
Opengraph URL: https://github.com/python/cpython/issues/106446
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Doctest fails in `stdtypes.rst`","articleBody":"# Documentation\r\n\r\nWhen some codes are modified, the doc and doctests are not updated synchronously.\r\n\r\n**Local doctest:**\r\n```shell\r\n./python -m doctest ./Doc/library/stdtypes.rst\r\n```\r\n\u003cdetails\u003e\u003csummary\u003eDetails\u003c/summary\u003e\r\n\u003cp\u003e\r\n\r\n```shell\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 3769, in stdtypes.rst\r\nFailed example:\r\n v[1:4]\r\nExpected:\r\n \u003cmemory at 0x7f3ddc9f4350\u003e\r\nGot:\r\n \u003cmemory at 0x7f42c250f040\u003e\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 3952, in stdtypes.rst\r\nFailed example:\r\n mm.tolist()\r\nExpected:\r\n [89, 98, 99]\r\nGot:\r\n [97, 98, 99]\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 4037, in stdtypes.rst\r\nFailed example:\r\n x[0] = b'a'\r\nExpected:\r\n Traceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n ValueError: memoryview: invalid value for format \"B\"\r\nGot:\r\n Traceback (most recent call last):\r\n File \"/home/github/cpython/Lib/doctest.py\", line 1357, in __run\r\n exec(compile(example.source, filename, \"single\",\r\n File \"\u003cdoctest stdtypes.rst[234]\u003e\", line 1, in \u003cmodule\u003e\r\n x[0] = b'a'\r\n ~^^^\r\n TypeError: memoryview: invalid type for format 'B'\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 4789, in stdtypes.rst\r\nFailed example:\r\n keys ^ {'sausage', 'juice'}\r\nExpected:\r\n {'juice', 'sausage', 'bacon', 'spam'}\r\nGot:\r\n {'spam', 'sausage', 'bacon', 'juice'}\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 4791, in stdtypes.rst\r\nFailed example:\r\n keys | ['juice', 'juice', 'juice']\r\nExpected:\r\n {'juice', 'sausage', 'bacon', 'spam', 'eggs'}\r\nGot:\r\n {'spam', 'bacon', 'juice'}\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 4997, in stdtypes.rst\r\nFailed example:\r\n dict[str][str]\r\nExpected:\r\n Traceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n TypeError: There are no type variables left in dict[str]\r\nGot:\r\n Traceback (most recent call last):\r\n File \"/home/github/cpython/Lib/doctest.py\", line 1357, in __run\r\n exec(compile(example.source, filename, \"single\",\r\n File \"\u003cdoctest stdtypes.rst[335]\u003e\", line 1, in \u003cmodule\u003e\r\n dict[str][str]\r\n ~~~~~~~~~^^^^^\r\n TypeError: dict[str] is not a generic class\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 5209, in stdtypes.rst\r\nFailed example:\r\n isinstance(1, int | list[int])\r\nExpected:\r\n Traceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n TypeError: isinstance() argument 2 cannot contain a parameterized generic\r\nGot:\r\n True\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 5514, in stdtypes.rst\r\nFailed example:\r\n int.__subclasses__()\r\nExpected:\r\n [\u003cclass 'bool'\u003e]\r\nGot:\r\n [\u003cclass 'bool'\u003e, \u003cenum 'IntEnum'\u003e, \u003cflag 'IntFlag'\u003e, \u003cclass 're._constants._NamedIntConstant'\u003e]\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 5548, in stdtypes.rst\r\nFailed example:\r\n _ = int('2' * 5432)\r\nExpected:\r\n Traceback (most recent call last):\r\n ...\r\n ValueError: Exceeds the limit (4300 digits) for integer string conversion: value has 5432 digits; use sys.set_int_max_str_digits() to increase the limit.\r\nGot:\r\n Traceback (most recent call last):\r\n File \"/home/github/cpython/Lib/doctest.py\", line 1357, in __run\r\n exec(compile(example.source, filename, \"single\",\r\n File \"\u003cdoctest stdtypes.rst[361]\u003e\", line 1, in \u003cmodule\u003e\r\n _ = int('2' * 5432)\r\n ^^^^^^^^^^^^^^^\r\n ValueError: Exceeds the limit (4300 digits) for integer string conversion: value has 5432 digits; use sys.set_int_max_str_digits() to increase the limit\r\n**********************************************************************\r\nFile \"./Doc/library/stdtypes.rst\", line 5556, in stdtypes.rst\r\nFailed example:\r\n len(str(i_squared))\r\nExpected:\r\n Traceback (most recent call last):\r\n ...\r\n ValueError: Exceeds the limit (4300 digits) for integer string conversion: value has 8599 digits; use sys.set_int_max_str_digits() to increase the limit.\r\nGot:\r\n Traceback (most recent call last):\r\n File \"/home/github/cpython/Lib/doctest.py\", line 1357, in __run\r\n exec(compile(example.source, filename, \"single\",\r\n File \"\u003cdoctest stdtypes.rst[365]\u003e\", line 1, in \u003cmodule\u003e\r\n len(str(i_squared))\r\n ^^^^^^^^^^^^^^\r\n ValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit\r\n**********************************************************************\r\n```\r\n\r\n\u003c/p\u003e\r\n\u003c/details\u003e \r\n\r\n```shell\r\n1 items had failures:\r\n 10 of 374 in stdtypes.rst\r\n***Test Failed*** 10 failures.\r\n```\r\n\r\nBTW, It seems that all doctests are passing in the CI pipeline. Those failed cases are not found by CI doctest.\r\nSee: https://github.com/CharlieZhao95/cpython/actions/runs/5461321900/jobs/9939195566\r\n```shell\r\n...\r\nDocument: library/stdtypes\r\n--------------------------\r\n1 items passed all tests:\r\n 50 tests in default\r\n50 tests in 1 items.\r\n50 passed and 0 failed.\r\nTest passed.\r\n```\r\n\r\n**Environment:**\r\n\r\nCPython versions tested on: 3.13.0a0\r\nOperating system and architecture: Ubuntu 22.04.1 LTS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-106447\n* gh-106741\n* gh-106742\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/CharlieZhao95","@type":"Person","name":"CharlieZhao95"},"datePublished":"2023-07-05T08:49:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/106446/cpython/issues/106446"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8b8be6ca-4327-9988-ffab-d6ea31f90764 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C21A:8F2D5:FACD12:15EEB4E:696A34B8 |
| html-safe-nonce | 603db0e4344e601c751b9d52587d79087eb8c87c6921ab35b72bd7c2590bb597 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjFBOjhGMkQ1OkZBQ0QxMjoxNUVFQjRFOjY5NkEzNEI4IiwidmlzaXRvcl9pZCI6Ijg2NzYwMDg0NzQyNzQ1NzU1NDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 886b194f696231c3283ae54b9532415fc7299fbf6b633f3e3d1912e2257aa7f2 |
| hovercard-subject-tag | issue:1789084311 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/106446/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eac63875a3ff3a90c3806b1f85f6b9e64cfcd0ad99a93dd8d5ae123c3b112ee1/python/cpython/issues/106446 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eac63875a3ff3a90c3806b1f85f6b9e64cfcd0ad99a93dd8d5ae123c3b112ee1/python/cpython/issues/106446 |
| og:image:alt | Documentation When some codes are modified, the doc and doctests are not updated synchronously. Local doctest: ./python -m doctest ./Doc/library/stdtypes.rst Details *******************************... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CharlieZhao95 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 321736bfdb3f591415ae895a0459bec204b26a76caf47ba5c980634cfacc4538 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7a9163cefd1ea4bd06f8eb7c082f43e4e53f626f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width