File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -3207,7 +3207,6 @@ def test_wildcard_makes_remaining_patterns_unreachable_5(self):
32073207 pass
32083208 """ )
32093209
3210- @unittest .expectedFailure # TODO: RUSTPYTHON
32113210 def test_mapping_pattern_duplicate_key (self ):
32123211 self .assert_syntax_error ("""
32133212 match ...:
Original file line number Diff line number Diff line change @@ -3576,11 +3576,16 @@ impl Compiler {
35763576 let mut seen = std:: collections:: HashSet :: new ( ) ;
35773577 for key in keys {
35783578 let is_attribute = matches ! ( key, Expr :: Attribute ( _) ) ;
3579- let key_repr = if let Expr :: NumberLiteral ( _)
3580- | Expr :: StringLiteral ( _)
3581- | Expr :: BooleanLiteral ( _) = key
3582- {
3583- format ! ( "{:?}" , key)
3579+ let is_literal = matches ! (
3580+ key,
3581+ Expr :: NumberLiteral ( _)
3582+ | Expr :: StringLiteral ( _)
3583+ | Expr :: BytesLiteral ( _)
3584+ | Expr :: BooleanLiteral ( _)
3585+ | Expr :: NoneLiteral ( _)
3586+ ) ;
3587+ let key_repr = if is_literal {
3588+ unparse_expr ( key, & self . source_file ) . to_string ( )
35843589 } else if is_attribute {
35853590 String :: new ( )
35863591 } else {
You can’t perform that action at this time.
0 commit comments