1919
2020
2121async def test_that_js_module_unmount_is_called (display : DisplayFixture ):
22- SomeComponent = reactpy .web .import_components (
22+ SomeComponent = reactpy .web .export (
2323 reactpy .web .module_from_file (
2424 "set-flag-when-unmount-is-called" ,
2525 JS_FIXTURES_DIR / "set-flag-when-unmount-is-called.js" ,
@@ -52,7 +52,7 @@ def ShowCurrentComponent():
5252
5353
5454async def test_module_from_url (browser ):
55- SimpleButton = reactpy .web .import_components (
55+ SimpleButton = reactpy .web .export (
5656 reactpy .web .module_from_url ("/static/simple-button.js" , resolve_exports = False ),
5757 "SimpleButton" ,
5858 )
@@ -72,7 +72,7 @@ def ShowSimpleButton():
7272
7373
7474async def test_module_from_file (display : DisplayFixture ):
75- SimpleButton = reactpy .web .import_components (
75+ SimpleButton = reactpy .web .export (
7676 reactpy .web .module_from_file (
7777 "simple-button" , JS_FIXTURES_DIR / "simple-button.js"
7878 ),
@@ -163,14 +163,14 @@ def test_module_missing_exports():
163163 module = WebModule ("test" , NAME_SOURCE , None , {"a" , "b" , "c" }, None , False )
164164
165165 with pytest .raises (ValueError , match = "does not export 'x'" ):
166- reactpy .web .import_components (module , "x" )
166+ reactpy .web .export (module , "x" )
167167
168168 with pytest .raises (ValueError , match = r"does not export \['x', 'y'\]" ):
169- reactpy .web .import_components (module , ["x" , "y" ])
169+ reactpy .web .export (module , ["x" , "y" ])
170170
171171
172172async def test_module_exports_multiple_components (display : DisplayFixture ):
173- Header1 , Header2 = reactpy .web .import_components (
173+ Header1 , Header2 = reactpy .web .export (
174174 reactpy .web .module_from_file (
175175 "exports-two-components" , JS_FIXTURES_DIR / "exports-two-components.js"
176176 ),
@@ -190,7 +190,7 @@ async def test_imported_components_can_render_children(display: DisplayFixture):
190190 module = reactpy .web .module_from_file (
191191 "component-can-have-child" , JS_FIXTURES_DIR / "component-can-have-child.js"
192192 )
193- Parent , Child = reactpy .web .import_components (module , ["Parent" , "Child" ])
193+ Parent , Child = reactpy .web .export (module , ["Parent" , "Child" ])
194194
195195 await display .show (
196196 lambda : Parent (
@@ -222,7 +222,7 @@ async def test_keys_properly_propagated(display: DisplayFixture):
222222 module = reactpy .web .module_from_file (
223223 "keys-properly-propagated" , JS_FIXTURES_DIR / "keys-properly-propagated.js"
224224 )
225- GridLayout = reactpy .web .import_components (module , "GridLayout" )
225+ GridLayout = reactpy .web .export (module , "GridLayout" )
226226
227227 await display .show (
228228 lambda : GridLayout (
@@ -277,7 +277,7 @@ async def test_subcomponent_notation_as_str_attrs(display: DisplayFixture):
277277 "subcomponent-notation" ,
278278 JS_FIXTURES_DIR / "subcomponent-notation.js" ,
279279 )
280- InputGroup , InputGroupText , FormControl , FormLabel = reactpy .web .import_components (
280+ InputGroup , InputGroupText , FormControl , FormLabel = reactpy .web .export (
281281 module , ["InputGroup" , "InputGroup.Text" , "Form.Control" , "Form.Label" ]
282282 )
283283
@@ -337,7 +337,7 @@ async def test_subcomponent_notation_as_obj_attrs(display: DisplayFixture):
337337 "subcomponent-notation" ,
338338 JS_FIXTURES_DIR / "subcomponent-notation.js" ,
339339 )
340- InputGroup , Form = reactpy .web .import_components (module , ["InputGroup" , "Form" ])
340+ InputGroup , Form = reactpy .web .export (module , ["InputGroup" , "Form" ])
341341
342342 content = reactpy .html .div (
343343 {"id" : "the-parent" },
@@ -394,7 +394,7 @@ async def test_callable_prop_with_javacript(display: DisplayFixture):
394394 module = reactpy .web .module_from_file (
395395 "callable-prop" , JS_FIXTURES_DIR / "callable-prop.js"
396396 )
397- Component = reactpy .web .import_components (module , "Component" )
397+ Component = reactpy .web .export (module , "Component" )
398398
399399 @reactpy .component
400400 def App ():
@@ -415,11 +415,3 @@ def test_module_from_string():
415415 reactpy .web .module_from_string ("temp" , "old" )
416416 with assert_reactpy_did_log (r"Existing web module .* will be replaced with" ):
417417 reactpy .web .module_from_string ("temp" , "new" )
418-
419-
420- def test_deprecated_export ():
421- module = reactpy .web .module_from_string (
422- "temp" , "export function Component() { return 'hello' }"
423- )
424- with pytest .warns (DeprecationWarning , match = "The 'export' function is deprecated" ):
425- reactpy .web .export (module , "Component" )
0 commit comments