GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-94808: add tests covering `PySequence_[InPlace]Concat` by sobolevn · Pull Request #99319 · python/cpython

Conversation

@sobolevn

@sobolevn sobolevn commented Nov 10, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Key points:

  1. I've covered these two C-API function calls by covering operator module, which uses these functions in their C implementation. I think that this is better because it also tests a lot of other things, not just a single API function.
  2. I've followed the module style: it has big tests cases for operators, this is why I didn't bother creating a new spec or separate test cases for each sub-case
  • Issue: Metabug: Improving C-level coverage #94808

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sobolevn
pythongh-94808: add tests covering PySequence_[InPlace]Concat
3556649
@bedevere-bot bedevere-bot mentioned this pull request Nov 10, 2022
Metabug: Improving C-level coverage #94808
Open
@bedevere-bot bedevere-bot added awaiting review tests Tests in the Lib/test dir labels Nov 10, 2022
@sobolevn sobolevn added the skip news label Nov 10, 2022
sobolevn added 2 commits November 10, 2022 13:24
@sobolevn
Typo
359b007
@sobolevn
Typo
6cee271
@sobolevn

sobolevn commented Nov 10, 2022

Copy link
Copy Markdown
Member Author

There's an unrelated test failure:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:\a\1\b\test\test_python_3768�\test_python_worker_5520�'

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn sobolevn closed this Nov 13, 2022
@sobolevn sobolevn reopened this Nov 13, 2022
kumaraditya303
kumaraditya303 approved these changes Nov 24, 2022
View reviewed changes

@kumaraditya303 kumaraditya303 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Nov 24, 2022
@kumaraditya303

kumaraditya303 commented Nov 24, 2022

Copy link
Copy Markdown
Contributor

cc @gvanrossum

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gvanrossum
gvanrossum reviewed Nov 24, 2022
View reviewed changes

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's first have a discussion about the appearance and intentions of these tests here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_operator.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_operator.py Outdated
Comment on lines +538 to +542
self.assertEqual(operator.concat(data1, data2),
ListSubclass([1, 2, 'a', 'b']))
self.assertEqual(operator.concat(data1, data2), data1 + data2)
self.assertEqual(data1, ListSubclass([1, 2])) # must not change
self.assertEqual(data2, ListSubclass(['a', 'b'])) # must not change

@gvanrossum gvanrossum Nov 24, 2022

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't prove much. The results are in all cases list instances, not ListSubclass instances, because of the way list operator overloading works -- data1+data2 is a plain list, and __eq__ considers a plain list equal to a list subclass with the same elements. The test makes it appear differently.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sobolevn sobolevn Nov 25, 2022

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks! I've totally missed that. I've added several assertIsInstance checks and updated the expected values.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_operator.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn
Address review
5893ba7
gvanrossum
gvanrossum previously requested changes Nov 29, 2022
View reviewed changes

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I still have some quibbles.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_operator.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_operator.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_operator.py
TupleSubclass(['a', 'b', 1, 2]))
self.assertEqual(operator.concat(data1, data2), data1 + data2)
res = operator.concat(data1, data2)
self.assertIsInstance(res, TupleSubclass)

@gvanrossum gvanrossum Nov 29, 2022

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is good.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_operator.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting merge label Nov 29, 2022
@bedevere-bot

bedevere-bot commented Nov 29, 2022

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added the awaiting changes label Nov 29, 2022
@sobolevn
Merge branch 'main' into cover-sequence-concat
3f46389
@sobolevn

sobolevn commented Mar 24, 2023

Copy link
Copy Markdown
Member Author

Sorry, it took me quite longer than I expected to get back to it :)

I've addressed your main review points. I went with very defensive asserts in this case.
I agree that most of them do not make much sense.

So, I've made several changes to this PR:

  1. I've added more cases for subtypes to cover all combinations: subtype + subtype, subtype + parent, parent + subtype. It does not really affect coverage, but it feels like a right thing to do
  2. I've remove all type assertions except: results, arguments that do mutate (iconcat and list)
  3. I've changed type assertions for tuple and list to be exact, for example: self.assertIs(type(res), tuple)

So, I hope it should be good now!
Thanks again for the review, it helped a lot!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn
Address review
db068d7
@sobolevn

sobolevn commented Mar 24, 2023

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting change review and removed awaiting changes labels Mar 24, 2023
@bedevere-bot

bedevere-bot commented Mar 24, 2023

Copy link
Copy Markdown

Thanks for making the requested changes!

@kumaraditya303, @gvanrossum: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot
bedevere-bot requested review from gvanrossum and kumaraditya303 March 24, 2023 12:19
@gvanrossum

gvanrossum commented Mar 24, 2023

Copy link
Copy Markdown
Member

Please find another reviewer, I'm on vacation.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn

sobolevn commented Mar 24, 2023

Copy link
Copy Markdown
Member Author

Happy vacation 🏖️ 😊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303
kumaraditya303 removed their request for review July 8, 2023 08:56
@github-actions

github-actions Bot commented Apr 11, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 11, 2026
@ambv

ambv commented Oct 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR is superseded by #156966, a newer open pull request for the same issue (gh-94808), and it no longer merges cleanly. Closing to cull the number of open pull requests. Do not reopen this pull request without getting a go-ahead from a triager or core developer.

Reopening. This was prematurely closed because the meta issue was misidentified as a simple issue.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ambv ambv closed this Oct 20, 2026
@ambv ambv reopened this Oct 20, 2026
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 20, 2026
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Oct 21, 2026
ambv added 2 commits October 21, 2026 20:45
@ambv
Merge branch 'main' into cover-sequence-concat
ff42169
Co-authored-by: Muse Code (Meta Muse Spark)

# Conflicts:
#	Lib/test/test_operator.py
@ambv
Rename new test_concat to test_concat_subclasses
c4cfa7f
The PR added a second test_concat to OperatorTestCase, silently
shadowing the existing one and failing ruff F811. Give the new,
subclass-focused test its own name.

Co-authored-by: Muse Code (Meta Muse Spark)
ambv
ambv approved these changes Oct 21, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting change review labels Oct 21, 2026
@ambv
ambv dismissed gvanrossum’s stale review October 21, 2026 22:49

review addressed

@ambv
ambv merged commit 4036afb into python:main Oct 21, 2026
94 of 97 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ambv ambv ambv approved these changes
@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@gvanrossum gvanrossum Awaiting requested review from gvanrossum

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@sobolevn @kumaraditya303 @bedevere-bot @gvanrossum @ambv
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.