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

remove IS_PYTHON2 from tests too #279

Merged
merged 3 commits into from
Feb 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lupa/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_eval_error_message_decoding(self):
try:
self.lua.eval('require "UNKNOWNöMODULEäNAME"')
except self.lupa.LuaError:
error = '%s'.decode('ASCII') % sys.exc_info()[1]
error = str(sys.exc_info()[1])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

exc_info is already always a str

Copy link
Owner

Choose a reason for hiding this comment

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

No, it's an exception instance. But looking at it again, I noticed that we can avoid calling sys.exc_info all together just to get at the current exception that we're handling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy this goes well. Some other projects want to keep their cargo-culted compat.py forever.
There's always opportunity to learn new tricks.

else:
self.fail('expected error not raised')
expected_message = 'module \'UNKNOWNöMODULEäNAME\' not found'
Expand Down Expand Up @@ -2079,7 +2079,7 @@ def mandelbrot(i, lua_func):
# plausability checks - make sure it's not all white or all black
self.assertEqual('\0'.encode('ASCII')*(image_size//8//2),
result_bytes[:image_size//8//2])
self.assertTrue('\xFF'.encode('ISO-8859-1') in result_bytes)
self.assertTrue(b'\xFF' in result_bytes)

# if we have PIL, check that it can read the image
## try:
Expand Down
Loading