<s> from graphql . core . language . location import SourceLocation <EOL> from graphql . core . validation . rules import UniqueVariableNames <EOL> from . utils import expect_fails_rule , expect_passes_rule <EOL> def duplicate_var ( op_name , l1 , c1 , l2 , c2 ) : <EOL> return { <EOL> '<STR_LIT:message>' : UniqueVariableNames . duplicate_variable_message ( op_name ) , <EOL> '<STR_LIT>' : [ SourceLocation ( l1 , c1 ) , SourceLocation ( l2 , c2 ) ] <EOL> } <EOL> def test_unique_variable_names ( ) : <EOL> expect_passes_rule ( UniqueVariableNames , '''<STR_LIT>''' ) <EOL> def test_duplicate_variable_names ( ) : <EOL> expect_fails_rule ( UniqueVariableNames , '''<STR_LIT>''' , [ <EOL> duplicate_var ( '<STR_LIT:x>' , <NUM_LIT:2> , <NUM_LIT:16> , <NUM_LIT:2> , <NUM_LIT> ) , <EOL> duplicate_var ( '<STR_LIT:x>' , <NUM_LIT:2> , <NUM_LIT:16> , <NUM_LIT:2> , <NUM_LIT> ) , <EOL> duplicate_var ( '<STR_LIT:x>' , <NUM_LIT:3> , <NUM_LIT:16> , <NUM_LIT:3> , <NUM_LIT> ) , <EOL> duplicate_var ( '<STR_LIT:x>' , <NUM_LIT:4> , <NUM_LIT:16> , <NUM_LIT:4> , <NUM_LIT> ) , <EOL> ] ) </s>
