File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -1486,7 +1486,7 @@ def query_one(
14861486 continue
14871487 if expect_type is not None and not isinstance (node , expect_type ):
14881488 raise WrongType (
1489- f"Node matching { query_selector !r} is not of expected type { expect_type .__name__ !r} ; found { node } "
1489+ f"Node matching { query_selector !r} is the wrong type; expected type { expect_type .__name__ !r} ; found { node } "
14901490 )
14911491 if cache_key is not None :
14921492 base_node ._query_one_cache [cache_key ] = node
@@ -1560,13 +1560,11 @@ def query_exactly_one(
15601560 if not match (selector_set , node ):
15611561 continue
15621562 if expect_type is not None and not isinstance (node , expect_type ):
1563- continue
1563+ raise WrongType (
1564+ f"Node matching { query_selector !r} is the wrong type; expect type { expect_type .__name__ !r} ; found { node } "
1565+ )
15641566 for later_node in iter_children :
15651567 if match (selector_set , later_node ):
1566- if expect_type is not None and not isinstance (node , expect_type ):
1567- raise WrongType (
1568- f"Node matching { query_selector !r} is not of expected type { expect_type .__name__ !r} ; found { node } "
1569- )
15701568 raise TooManyMatches (
15711569 "Call to query_one resulted in more than one matched node"
15721570 )
You can’t perform that action at this time.
0 commit comments