Skip to content
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

Improve tests after removing deprecated textsize #100

Closed
wants to merge 18 commits into from

Conversation

nulano
Copy link

@nulano nulano commented Apr 5, 2023

For python-pillow#7059.

Changes proposed in this pull request:

  • Instead of removing test for ImageDraw2.textsize, modify it for ImageDraw2.textbbox
  • Remove duplicate asserts in test_imagefont:
    • "Check (w,h) of box a is (h,w) of box b" is included in "Check bbox b is (20, 20, 20 + h, 20 + w)"
    • "Check boxes a and b are same size" is included in "Check bbox b is (20, 20, 20 + w, 20 + h)"

@hugovk
Copy link
Owner

hugovk commented Apr 6, 2023

Thanks!

Remove duplicate asserts in test_imagefont:

  • "Check (w,h) of box a is (h,w) of box b" is included in "Check bbox b is (20, 20, 20 + h, 20 + w)"
  • "Check boxes a and b are same size" is included in "Check bbox b is (20, 20, 20 + w, 20 + h)"

The intent of "Check (w,h) of box a is (h,w) of box b" (-> "aha, so they must be the same but rotated") is much clearer than "Check bbox b is (20, 20, 20 + h, 20 + w)" -> ("hmm, where did these magic numbers come from? ah, okay, they're the original ones, plus we're calculating etc etc...").

So given a failure, I think the former is more readily debuggable. Can we remove the latter ones instead?

@radarhere
Copy link

I've included a version of this in python-pillow#7080

@nulano nulano closed this Apr 10, 2023
@nulano nulano deleted the rm-qt5 branch April 10, 2023 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants