Skip to content

bpo-39664: Add tests for operator module. #18537

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

Closed
wants to merge 2 commits into from

Conversation

tirkarthi
Copy link
Member

@tirkarthi tirkarthi commented Feb 17, 2020

Add tests for operator module to improve coverage.

  • iconcat should have getitem implemented.
  • Test index and not functions.
  • Test length_hint default value type.

https://bugs.python.org/issue39664

@codecov
Copy link

codecov bot commented Feb 17, 2020

Codecov Report

Merging #18537 into master will increase coverage by 1.08%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #18537       +/-   ##
===========================================
+ Coverage   82.11%   83.20%    +1.08%     
===========================================
  Files        1956     1571      -385     
  Lines      589364   414757   -174607     
  Branches    44457    44457               
===========================================
- Hits       483966   345096   -138870     
+ Misses      95746    60015    -35731     
+ Partials     9652     9646        -6     
Impacted Files Coverage Δ
Lib/distutils/tests/test_bdist_rpm.py 30.00% <0.00%> (-65.00%) ⬇️
Lib/distutils/command/bdist_rpm.py 7.63% <0.00%> (-56.88%) ⬇️
Lib/test/test_urllib2net.py 76.92% <0.00%> (-13.85%) ⬇️
Lib/test/test_smtpnet.py 78.57% <0.00%> (-7.15%) ⬇️
Lib/ftplib.py 63.85% <0.00%> (-6.06%) ⬇️
Lib/test/test_ftplib.py 87.11% <0.00%> (-4.72%) ⬇️
Tools/scripts/db2pickle.py 17.82% <0.00%> (-3.97%) ⬇️
Tools/scripts/pickle2db.py 16.98% <0.00%> (-3.78%) ⬇️
Lib/test/test_socket.py 71.94% <0.00%> (-3.77%) ⬇️
Lib/test/test_asyncio/test_base_events.py 91.84% <0.00%> (-3.30%) ⬇️
... and 434 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c1b6a6...42ebf5a. Read the comment docs.

@tirkarthi tirkarthi force-pushed the add-test-operator-module branch from 42ebf5a to 8717c9b Compare February 24, 2020 16:00
@serhiy-storchaka serhiy-storchaka self-requested a review March 14, 2020 11:24
with self.assertRaisesRegex(TypeError, msg):
operator.iconcat(X(), X())

def test_index(self):
Copy link
Member

Choose a reason for hiding this comment

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

operator.index is already tested in Lib/test/test_index.py.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess test_index only checks the C version of the module. This test covers the Python version with self.module used for C and Python version of the module.

Copy link
Member

Choose a reason for hiding this comment

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

Agree. Although it would be nice to extend this test. At least test it with int, float, Fraction, Decimal, None.

Copy link
Member

@iritkatriel iritkatriel left a comment

Choose a reason for hiding this comment

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

There is a merge conflict.

@bedevere-bot
Copy link

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@iritkatriel iritkatriel added the pending The issue will be closed if no feedback is provided label Nov 9, 2022
@iritkatriel
Copy link
Member

Marking as pending because this has been stale for a couple of years with no followup to the code review. If this is abandoned we should perhaps close it.

@tirkarthi
Copy link
Member Author

Thanks @iritkatriel for triaging. I am okay with closing this since this was mostly to make 100% code coverage and I am not actively working on this.

@tirkarthi tirkarthi closed this Nov 11, 2022
@hugovk hugovk reopened this Feb 24, 2024
@hugovk
Copy link
Member

hugovk commented Feb 24, 2024

I attempted to update this, but it won't let me push to it, so will make a new PR instead.


For reference:

$ gh co 18537 # branch is add-test-operator-module:refs/pull/18537/head
$ git merge upstream/main
$ # resolve conflict
$ git push
fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use

    git push upstream HEAD:refs/pull/18537/head

To push to the branch of the same name on the remote, use

    git push upstream HEAD

To choose either option permanently, see push.default in 'git help config'.

To avoid automatically configuring an upstream branch when its name
won't match the local branch, see option 'simple' of branch.autoSetupMerge
in 'git help config'.
$ git push upstream HEAD:refs/pull/18537/head
Found existing alias for "git push". You should use: "gp"
Enumerating objects: 23, done.
Counting objects: 100% (23/23), done.
Delta compression using up to 8 threads
Compressing objects: 100% (15/15), done.
Writing objects: 100% (15/15), 1.81 KiB | 1.81 MiB/s, done.
Total 15 (delta 12), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (12/12), completed with 7 local objects.
To https://github.com/python/cpython.git
 ! [remote rejected]       HEAD -> refs/pull/18537/head (deny updating a hidden ref)

@hugovk
Copy link
Member

hugovk commented Feb 24, 2024

Please see PR GH-115883.

@AA-Turner AA-Turner removed the pending The issue will be closed if no feedback is provided label Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants