File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ def __getattr__(widget_class: str) -> type[Widget]:
104104 pass
105105
106106 if widget_class not in __all__ :
107- raise ImportError (f"Package 'textual.widgets' has no class '{ widget_class } '" )
107+ raise AttributeError (f"Package 'textual.widgets' has no class '{ widget_class } '" )
108108
109109 widget_module_path = f"._{ camel_to_snake (widget_class )} "
110110 module = import_module (widget_module_path , package = "textual.widgets" )
Original file line number Diff line number Diff line change @@ -576,3 +576,11 @@ def test_bad_widget_name_raised() -> None:
576576
577577 class lowercaseWidget (Widget ):
578578 pass
579+
580+
581+ def test_lazy_loading () -> None :
582+ from textual import widgets
583+
584+ assert not hasattr (widgets , "foo" )
585+ assert not hasattr (widgets , "bar" )
586+ assert hasattr (widgets , "Label" )
You can’t perform that action at this time.
0 commit comments