File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -324,3 +324,6 @@ def try_mutate_str():
324324assert not "a" .__ne__ ("a" )
325325assert not "" .__ne__ ("" )
326326assert "" .__ne__ (1 ) == NotImplemented
327+
328+ assert "A_B" .isupper ()
329+ assert "a_b" .islower ()
Original file line number Diff line number Diff line change @@ -727,11 +727,12 @@ impl PyString {
727727
728728 #[ pymethod]
729729 fn isupper ( & self , _vm : & VirtualMachine ) -> bool {
730+ // TODO: assert not " ".isupper(), assert not "_".isupper()
730731 !self . value . is_empty ( )
731732 && self
732733 . value
733734 . chars ( )
734- . filter ( |x| !x. is_ascii_whitespace ( ) )
735+ . filter ( |x| !x. is_ascii_whitespace ( ) && * x != '_' )
735736 . all ( char:: is_uppercase)
736737 }
737738
@@ -741,7 +742,7 @@ impl PyString {
741742 && self
742743 . value
743744 . chars ( )
744- . filter ( |x| !x. is_ascii_whitespace ( ) )
745+ . filter ( |x| !x. is_ascii_whitespace ( ) && * x != '_' )
745746 . all ( char:: is_lowercase)
746747 }
747748
You can’t perform that action at this time.
0 commit comments