@@ -669,18 +669,22 @@ def check(z, x, y):
669669 check (complex ("1" ), 1.0 , 0.0 )
670670 check (complex ("1j" ), 0.0 , 1.0 )
671671 check (complex ("-1" ), - 1.0 , 0.0 )
672+ check (complex ("\N{MINUS SIGN} 1" ), - 1.0 , 0.0 )
672673 check (complex ("+1" ), 1.0 , 0.0 )
673674 check (complex ("1+2j" ), 1.0 , 2.0 )
674675 check (complex ("(1+2j)" ), 1.0 , 2.0 )
675676 check (complex ("(1.5+4.25j)" ), 1.5 , 4.25 )
676677 check (complex ("4.25+1J" ), 4.25 , 1.0 )
677678 check (complex (" ( +4.25-6J )" ), 4.25 , - 6.0 )
679+ check (complex (" ( +4.25\N{MINUS SIGN} 6J )" ), 4.25 , - 6.0 )
678680 check (complex (" ( +4.25-J )" ), 4.25 , - 1.0 )
681+ check (complex (" ( +4.25\N{MINUS SIGN} J )" ), 4.25 , - 1.0 )
679682 check (complex (" ( +4.25+j )" ), 4.25 , 1.0 )
680683 check (complex ("J" ), 0.0 , 1.0 )
681684 check (complex ("( j )" ), 0.0 , 1.0 )
682685 check (complex ("+J" ), 0.0 , 1.0 )
683686 check (complex ("( -j)" ), 0.0 , - 1.0 )
687+ check (complex ("( \N{MINUS SIGN} j)" ), 0.0 , - 1.0 )
684688 check (complex ('1-1j' ), 1.0 , - 1.0 )
685689 check (complex ('1J' ), 0.0 , 1.0 )
686690
@@ -690,6 +694,7 @@ def check(z, x, y):
690694 check (complex ('-1e-500+1e-500j' ), - 0.0 , 0.0 )
691695 check (complex ('1e-500-1e-500j' ), 0.0 , - 0.0 )
692696 check (complex ('-1e-500-1e-500j' ), - 0.0 , - 0.0 )
697+ check (complex ('\N{MINUS SIGN} 1e\N{MINUS SIGN} 500\N{MINUS SIGN} 1e\N{MINUS SIGN} 500j' ), - 0.0 , - 0.0 )
693698
694699 # SF bug 543840: complex(string) accepts strings with \0
695700 # Fixed in 2.3.
@@ -700,6 +705,8 @@ def check(z, x, y):
700705 self .assertRaises (ValueError , complex , "1+" )
701706 self .assertRaises (ValueError , complex , "1+1j+1j" )
702707 self .assertRaises (ValueError , complex , "--" )
708+ self .assertRaises (ValueError , complex , "-\N{MINUS SIGN} " )
709+ self .assertRaises (ValueError , complex , "\N{MINUS SIGN} \N{MINUS SIGN} " )
703710 self .assertRaises (ValueError , complex , "(1+2j" )
704711 self .assertRaises (ValueError , complex , "1+2j)" )
705712 self .assertRaises (ValueError , complex , "1+(2j)" )
@@ -726,7 +733,9 @@ def test_constructor_negative_nans_from_string(self):
726733 self .assertEqual (copysign (1. , complex ("-nan" ).real ), - 1. )
727734 self .assertEqual (copysign (1. , complex ("-nanj" ).imag ), - 1. )
728735 self .assertEqual (copysign (1. , complex ("-nan-nanj" ).real ), - 1. )
736+ self .assertEqual (copysign (1. , complex ("-nan\N{MINUS SIGN} nanj" ).real ), - 1. )
729737 self .assertEqual (copysign (1. , complex ("-nan-nanj" ).imag ), - 1. )
738+ self .assertEqual (copysign (1. , complex ("\N{MINUS SIGN} nan\N{MINUS SIGN} nanj" ).imag ), - 1. )
730739
731740 def test_underscores (self ):
732741 # check underscores
0 commit comments