File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,8 @@ def func():
273273 assert c .value == "c[b < 1 and b > 0]"
274274 c [b < 1 or b > 0 ] = func ()
275275 assert c .value == "c[b < 1 or b > 0]"
276+ c [0 < b < 2 ] = func ()
277+ assert c .value == "c[0 < b < 2]"
276278
277279
278280def test_unusual ():
Original file line number Diff line number Diff line change @@ -274,14 +274,11 @@ def node_name(
274274 str (node_name (value )) for value in node .values
275275 )
276276 if isinstance (node , ast .Compare ):
277- # When the node is identified by executing, len(ops) is always 1.
278- # Otherwise, the node cannot be identified.
279- assert len (node .ops ) == 1
280- return (
281- f"{ node_name (node .left )} "
282- f"{ OP2SYMBOL [type (node .ops [0 ])]} "
283- f"{ node_name (node .comparators [0 ])} "
284- )
277+ parts = [str (node_name (node .left ))]
278+ for op , comparator in zip (node .ops , node .comparators ):
279+ parts .append (OP2SYMBOL [type (op )])
280+ parts .append (str (node_name (comparator )))
281+ return " " .join (parts )
285282 if isinstance (node , ast .UnaryOp ):
286283 return f"{ OP2SYMBOL [type (node .op )]} { node_name (node .operand )} "
287284
You can’t perform that action at this time.
0 commit comments