-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
gh-138621: Increase test coverage for csv.DictReader and csv.Sniffer #138622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-138621: Increase test coverage for csv.DictReader and csv.Sniffer #138622
Conversation
Previously there were no tests for the DictReader fieldnames setter, the case where a StopIteration was encountered when trying to determine the fieldnames from the content or the case where Sniffer could not find a delimiter.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
I had originally skipped adding a test for the "check > 20" line because i thought that might be an implementation detail we dont want to fix down, but after seeing this, i realized this is officially documented so i think it makes sense to add a test for it. This now gets us to |
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
I think the test failure is unrelated? |
|
Yes, don't worry |
|
Thanks @JanEricNitschke for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…iffer (pythonGH-138622) * Increase test coverage for csv.DictReader and csv.Sniffer Previously there were no tests for the DictReader fieldnames setter, the case where a StopIteration was encountered when trying to determine the fieldnames from the content or the case where Sniffer could not find a delimiter. * Revert whitespace change to comment * Add a test that csv.Sniffer.has_header checks up to 20 rows * Replace name and age with letter and offset Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> * Address review comment --------- (cherry picked from commit 0e88be6) Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
|
GH-141436 is a backport of this pull request to the 3.14 branch. |
…niffer (GH-138622) (#141436) gh-138621: Increase test coverage for csv.DictReader and csv.Sniffer (GH-138622) * Increase test coverage for csv.DictReader and csv.Sniffer Previously there were no tests for the DictReader fieldnames setter, the case where a StopIteration was encountered when trying to determine the fieldnames from the content or the case where Sniffer could not find a delimiter. * Revert whitespace change to comment * Add a test that csv.Sniffer.has_header checks up to 20 rows * Replace name and age with letter and offset * Address review comment --------- (cherry picked from commit 0e88be6) Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
…iffer (pythonGH-138622) * Increase test coverage for csv.DictReader and csv.Sniffer Previously there were no tests for the DictReader fieldnames setter, the case where a StopIteration was encountered when trying to determine the fieldnames from the content or the case where Sniffer could not find a delimiter. * Revert whitespace change to comment * Add a test that csv.Sniffer.has_header checks up to 20 rows * Replace name and age with letter and offset Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> * Address review comment --------- Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Previously there were no tests for the DictReader fieldnames setter, the case where a StopIteration was encountered when trying to determine the fieldnames from the content or the case where Sniffer could not find a delimiter.
Previously:
After:
This is my first attempt at contributing to CPython. I read through the dev guide. The easy issues (at least the recent ones i checked) seem to all already be assigned to someone and so i want the Increase test coverage.
Currently just going through modules alphabetically to check where i can see some fairly easy targets for increasing coverage. If there are any larger or more important modules i would love to have a look at those too if you could point me to them before i get to them in alphabetical order.