@@ -10,20 +10,28 @@ def test_resolve_deprecation_warning(ens):
10
10
"`ENS.address\\ (\\ )` for forward resolution, and `ENS.name\\ (\\ )` for reverse "
11
11
"resolution instead."
12
12
):
13
- ens .resolve (' tester.eth' )
13
+ ens .resolve (" tester.eth" )
14
14
15
15
16
- def test_resolver_future_warning (ens ):
16
+ def test_resolver_future_warning_when_name_is_missing (ens ):
17
17
with pytest .warns (
18
18
FutureWarning ,
19
19
match = "The function signature for resolver\\ (\\ ) will change in v6 to accept `name` as a "
20
20
"the positional argument, over `normal_name`, and the method will instead "
21
- "normalize the name internally. To suppress warnings for now, `name` may be passed "
22
- "in as a keyword argument ." ,
21
+ "normalize the name internally. You may migrate to using `name` by passing it in "
22
+ "as a keyword, e.g. resolver \\ (name= \" ensname.eth \" \\ ) ." ,
23
23
):
24
- ens .resolver ('tester. eth' )
24
+ assert ens .resolver (" eth" )
25
25
26
- # assert no warning when `name` kwarg is passed in
26
+ # assert no warning when `name` is passed in as a kwarg
27
27
with warnings .catch_warnings ():
28
28
warnings .simplefilter ("error" ) # turn all warnings to errors
29
- ens .resolver ('tester.eth' , name = 'tester.eth' )
29
+ assert ens .resolver (name = "EtH" )
30
+
31
+ # assert TypeError if both arguments passed in
32
+ with pytest .raises (
33
+ TypeError ,
34
+ match = "Only supply one positional argument or the `name` keyword, e.g. resolver\\ ("
35
+ "\" ensname.eth\" \\ ) or resolver\\ (name=\" ensname.eth\" \\ )." ,
36
+ ):
37
+ ens .resolver ("eth" , name = "EtH" )
0 commit comments