@@ -445,7 +445,9 @@ def h():
445
445
446
446
assert_equal (remove_misplaced_type_comments (original ), dest )
447
447
448
- def test_common_dir_prefix (self ) -> None :
448
+ @unittest .skipIf (sys .platform == 'win32' ,
449
+ 'Tests building the paths common ancestor on *nix' )
450
+ def test_common_dir_prefix_unix (self ) -> None :
449
451
assert common_dir_prefix ([]) == '.'
450
452
assert common_dir_prefix (['x.pyi' ]) == '.'
451
453
assert common_dir_prefix (['./x.pyi' ]) == '.'
@@ -458,6 +460,26 @@ def test_common_dir_prefix(self) -> None:
458
460
assert common_dir_prefix (['foo/x.pyi' , 'foo/bar/zar/y.pyi' ]) == 'foo'
459
461
assert common_dir_prefix (['foo/bar/zar/x.pyi' , 'foo/bar/y.pyi' ]) == 'foo/bar'
460
462
assert common_dir_prefix (['foo/bar/x.pyi' , 'foo/bar/zar/y.pyi' ]) == 'foo/bar'
463
+ assert common_dir_prefix ([r'foo/bar\x.pyi' ]) == 'foo'
464
+ assert common_dir_prefix ([r'foo\bar/x.pyi' ]) == r'foo\bar'
465
+
466
+ @unittest .skipIf (sys .platform != 'win32' ,
467
+ 'Tests building the paths common ancestor on Windows' )
468
+ def test_common_dir_prefix_win (self ) -> None :
469
+ assert common_dir_prefix (['x.pyi' ]) == '.'
470
+ assert common_dir_prefix ([r'.\x.pyi' ]) == '.'
471
+ assert common_dir_prefix ([r'foo\bar\x.pyi' ]) == r'foo\bar'
472
+ assert common_dir_prefix ([r'foo\bar\x.pyi' ,
473
+ r'foo\bar\y.pyi' ]) == r'foo\bar'
474
+ assert common_dir_prefix ([r'foo\bar\x.pyi' , r'foo\y.pyi' ]) == 'foo'
475
+ assert common_dir_prefix ([r'foo\x.pyi' , r'foo\bar\y.pyi' ]) == 'foo'
476
+ assert common_dir_prefix ([r'foo\bar\zar\x.pyi' , r'foo\y.pyi' ]) == 'foo'
477
+ assert common_dir_prefix ([r'foo\x.pyi' , r'foo\bar\zar\y.pyi' ]) == 'foo'
478
+ assert common_dir_prefix ([r'foo\bar\zar\x.pyi' , r'foo\bar\y.pyi' ]) == r'foo\bar'
479
+ assert common_dir_prefix ([r'foo\bar\x.pyi' , r'foo\bar\zar\y.pyi' ]) == r'foo\bar'
480
+ assert common_dir_prefix ([r'foo/bar\x.pyi' ]) == r'foo\bar'
481
+ assert common_dir_prefix ([r'foo\bar/x.pyi' ]) == r'foo\bar'
482
+ assert common_dir_prefix ([r'foo/bar/x.pyi' ]) == r'foo\bar'
461
483
462
484
463
485
class StubgenHelpersSuite (unittest .TestCase ):
0 commit comments