This repository was archived by the owner on Jul 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -128,14 +128,14 @@ def main(args=None, stdout=sys.stdout):
128128 sys .exit (- 1 )
129129
130130 def read_file (filename ):
131- with open (filename ) as f :
131+ with open (filename , "rb" ) as f :
132132 text = f .read ()
133133 codepage = chardet .detect (text )['encoding' ]
134134 return text .decode (codepage ).splitlines ()
135135
136136 a = read_file (args [0 ])
137137 b = read_file (args [1 ])
138- six . print_ (diff (a , b , css = options .css ).encode (' utf-8' ), file = stdout )
138+ stdout . write (diff (a , b , css = options .css ).encode (" utf-8" ) )
139139
140140if __name__ == "__main__" :
141141 main (sys .argv [1 :])
Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ def test_script(self):
3333 out = io .BytesIO ()
3434 ghdiff .main ([f1 , f2 ], stdout = out )
3535 output = out .getvalue ()
36- self .assertTrue ("-foobar" in output )
37- self .assertTrue ('+foobar<span class="highlight">baz</span>' in output )
36+ self .assertTrue (b "-foobar" in output )
37+ self .assertTrue (b '+foobar<span class="highlight">baz</span>' in output )
3838
3939 def test_no_css_option (self ):
4040 """Simple test for --no-css option"""
@@ -43,7 +43,7 @@ def test_no_css_option(self):
4343 out = io .BytesIO ()
4444 ghdiff .main ([f1 , f2 , "--no-css" ], stdout = out )
4545 output = out .getvalue ()
46- self .assertFalse ("<style" in output )
46+ self .assertFalse (b "<style" in output )
4747
4848
4949def test_suite ():
You can’t perform that action at this time.
0 commit comments