@@ -551,16 +551,22 @@ def test_with_suffix_common(self):
551551 self .assertEqual (P ('/a/b' ).with_suffix ('.gz' ), P ('/a/b.gz' ))
552552 self .assertEqual (P ('a/b.py' ).with_suffix ('.gz' ), P ('a/b.gz' ))
553553 self .assertEqual (P ('/a/b.py' ).with_suffix ('.gz' ), P ('/a/b.gz' ))
554+ # Stripping suffix
555+ self .assertEqual (P ('a/b.py' ).with_suffix ('' ), P ('a/b' ))
556+ self .assertEqual (P ('/a/b' ).with_suffix ('' ), P ('/a/b' ))
554557 # Path doesn't have a "filename" component
555558 self .assertRaises (ValueError , P ('' ).with_suffix , '.gz' )
556559 self .assertRaises (ValueError , P ('.' ).with_suffix , '.gz' )
557560 self .assertRaises (ValueError , P ('/' ).with_suffix , '.gz' )
558561 # Invalid suffix
559562 self .assertRaises (ValueError , P ('a/b' ).with_suffix , 'gz' )
560563 self .assertRaises (ValueError , P ('a/b' ).with_suffix , '/' )
564+ self .assertRaises (ValueError , P ('a/b' ).with_suffix , '.' )
561565 self .assertRaises (ValueError , P ('a/b' ).with_suffix , '/.gz' )
562566 self .assertRaises (ValueError , P ('a/b' ).with_suffix , 'c/d' )
563567 self .assertRaises (ValueError , P ('a/b' ).with_suffix , '.c/.d' )
568+ self .assertRaises (ValueError , P ('a/b' ).with_suffix , './.d' )
569+ self .assertRaises (ValueError , P ('a/b' ).with_suffix , '.d/.' )
564570
565571 def test_relative_to_common (self ):
566572 P = self .cls
0 commit comments