@@ -140,20 +140,20 @@ def test_tree_methods_with_registered_namespaces(namespace, bounds_df):
140140 assert_frame_equal (tree , expected )
141141
142142
143- @pytest .mark .parametrize (
144- "tree_method" ,
145- [tree_flatten , tree_leaves , leaf_names , tree_map , tree_flatten ],
146- )
147- def test_tree_methods_raise_warning_with_unregisted_namespace (tree_method , value_df ):
148- """If namespace is not registered optree method fallbacks to default behaviour."""
143+ def test_tree_methods_raise_warning_with_unregisted_namespace ():
149144 unregistered_namespace = "unregistered_namespace"
150- with pytest .warns (match = "is not registered." ):
151- if tree_method == tree_map :
152- _ = tree_map (lambda x : x , value_df , namespace = unregistered_namespace )
153- elif tree_method == tree_unflatten :
154- _ = tree_method (value_df , [], namespace = unregistered_namespace )
155- else :
156- _ = tree_method (value_df , namespace = unregistered_namespace )
145+ tree , leaves = [0 ], [0 ]
146+ match_str = "is not registered."
147+ with pytest .warns (match = match_str ):
148+ tree_flatten (tree , namespace = unregistered_namespace )
149+ with pytest .warns (match = match_str ):
150+ tree_leaves (tree , namespace = unregistered_namespace )
151+ with pytest .warns (match = match_str ):
152+ tree_unflatten (tree , leaves , namespace = unregistered_namespace )
153+ with pytest .warns (match = match_str ):
154+ leaf_names (tree , namespace = unregistered_namespace )
155+ with pytest .warns (match = match_str ):
156+ tree_map (lambda x : x * 2 , tree , namespace = unregistered_namespace )
157157
158158
159159def test_tree_flatten_and_unflatten_with_None ():
0 commit comments