Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commented May 20, 2024

Copy link
Member

@mdickinsonmdickinson left a comment

Choose a reason for hiding this comment

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

LGTM; two nitpick-level comments.

@serhiy-storchakaserhiy-storchakaforce-pushed the tests-fractions-mixed-arithmetic branch from dc34aa1 to c1f6081CompareMay 20, 2024 18:37
@serhiy-storchakaserhiy-storchaka merged commit fe67af1 into python:mainMay 20, 2024
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@serhiy-storchakaserhiy-storchaka deleted the tests-fractions-mixed-arithmetic branch May 20, 2024 19:34
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2024
…GH-119236) (cherry picked from commit fe67af1) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2024
…GH-119236) (cherry picked from commit fe67af1) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

GH-119255 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label May 20, 2024
@bedevere-app
Copy link

GH-119256 is a backport of this pull request to the 3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12 only security fixes label May 20, 2024
serhiy-storchaka added a commit that referenced this pull request May 20, 2024
…9236) (GH-119256) (cherry picked from commit fe67af1) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request May 20, 2024
…9236) (GH-119255) (cherry picked from commit fe67af1) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@JelleZijlstraJelleZijlstra mentioned this pull request May 28, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
@scoder
Copy link
Contributor

I noticed that the newly added tests are written the wrong way around. When a test fails, it says something like

Traceback (most recent call last): File "test_fractions.py", line …, in testMixedDivision self.assertTypedEquals(F(3, 2) / Rat(3, 5), Rat(15, 6)) File "test_fractions.py", line …, in assertTypedEquals self.assertEqual(type(expected), type(actual)) AssertionError: <class 'Fraction'> != <class '__main__.Rat'> 

Note how expected and actual are reversed here. This is misleading and it took me a couple of looks to understand that I was simply searching for the wrong kind of bug. The previously existing tests were apparently written the other way round:

 self.assertTypedEquals(F(1, 10), F(1, 10) / 1) # existing 

versus

 self.assertTypedEquals(F(3, 2) / DummyFraction(3, 5), F(5, 2)) # new 

scoder added a commit to scoder/quicktions that referenced this pull request Nov 28, 2024
@serhiy-storchaka
Copy link
MemberAuthor

The normal order for assertEqual() is actual, expected. But some old tests are written with other order. We do not touch them to avoid code churn. It seems that old tests here were written in such order, but assertTy po edEquals then reverted the order .

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@serhiy-storchaka@scoder@mdickinson