77import datetime
88import io
99import locale
10+ import os
1011import sys
1112import time
1213
@@ -928,7 +929,7 @@ def test_several_leapyears_in_range(self):
928929
929930
930931def conv (s ):
931- return s .encode ()
932+ return s .replace ( ' \n ' , os . linesep ). encode ()
932933
933934class CommandLineTestCase (unittest .TestCase ):
934935 def setUp (self ):
@@ -1034,6 +1035,7 @@ def test_option_encoding(self):
10341035 def test_option_locale (self ):
10351036 self .assertFailure ('-L' )
10361037 self .assertFailure ('--locale' )
1038+ self .assertFailure ('-L' , 'en' )
10371039
10381040 lang , enc = locale .getlocale ()
10391041 lang = lang or 'C'
@@ -1067,7 +1069,7 @@ def test_option_lines(self):
10671069 self .assertFailure ('-l' , 'spam' )
10681070 for run in self .runners :
10691071 output = run ('--lines' , '2' , '2004' )
1070- self .assertRegex ( output , br 'December(\r\n|\n){2}Mo Tu We' )
1072+ self .assertIn ( conv ( 'December\n \n Mo Tu We' ), output )
10711073
10721074 def test_option_spacing (self ):
10731075 self .assertFailure ('-s' )
@@ -1083,7 +1085,7 @@ def test_option_months(self):
10831085 self .assertFailure ('-m' , 'spam' )
10841086 for run in self .runners :
10851087 output = run ('--months' , '1' , '2004' )
1086- self .assertRegex ( output , br'(\r\n|\n)Mo Tu We Th Fr Sa Su(\r\n|\n)' )
1088+ self .assertIn ( conv ( ' \n Mo Tu We Th Fr Sa Su\n ' ), output )
10871089
10881090 def test_option_type (self ):
10891091 self .assertFailure ('-t' )
0 commit comments