Skip to content

Commit

Permalink
Merge pull request #2396 from HalfWhitt/getattr
Browse files Browse the repository at this point in the history
Simplifying static getattr calls
  • Loading branch information
freakboy3742 authored Feb 14, 2024
2 parents 7793fde + e0ea3ae commit f370257
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions changes/2396.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
getattr calls with string literals for attr have been collapsed to dot lookup.
4 changes: 2 additions & 2 deletions testbed/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def app():
@fixture
async def app_probe(app):
module = import_module("tests_backend.app")
probe = getattr(module, "AppProbe")(app)
probe = module.AppProbe(app)

if app.run_slow:
print("\nConstructing app probe")
Expand All @@ -62,7 +62,7 @@ async def main_window_probe(app, main_window):
module = import_module("tests_backend.window")
if app.run_slow:
print("\nConstructing Window probe")
yield getattr(module, "WindowProbe")(app, main_window)
yield module.WindowProbe(app, main_window)

main_window.content = old_content

Expand Down
2 changes: 1 addition & 1 deletion testbed/tests/test_fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def font_probe(main_window, widget):
main_window.content = box

module = import_module("tests_backend.widgets.label")
probe = getattr(module, "LabelProbe")(widget)
probe = module.LabelProbe(widget)
await probe.redraw("\nConstructing Font probe")
probe.assert_container(box)

Expand Down
2 changes: 1 addition & 1 deletion testbed/tests/test_icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def icon_probe(app, image):
module = import_module("tests_backend.icons")
return getattr(module, "IconProbe")(app, image)
return module.IconProbe(app, image)


async def test_icon(app):
Expand Down
2 changes: 1 addition & 1 deletion testbed/tests/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def image_probe(app, image):
module = import_module("tests_backend.images")
return getattr(module, "ImageProbe")(app, image)
return module.ImageProbe(app, image)


async def test_local_image(app):
Expand Down
2 changes: 1 addition & 1 deletion testbed/tests/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

def window_probe(app, window):
module = import_module("tests_backend.window")
return getattr(module, "WindowProbe")(app, window)
return module.WindowProbe(app, window)


@pytest.fixture
Expand Down

0 comments on commit f370257

Please sign in to comment.