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):
128
128
sys .exit (- 1 )
129
129
130
130
def read_file (filename ):
131
- with open (filename ) as f :
131
+ with open (filename , "rb" ) as f :
132
132
text = f .read ()
133
133
codepage = chardet .detect (text )['encoding' ]
134
134
return text .decode (codepage ).splitlines ()
135
135
136
136
a = read_file (args [0 ])
137
137
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" ) )
139
139
140
140
if __name__ == "__main__" :
141
141
main (sys .argv [1 :])
Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ def test_script(self):
33
33
out = io .BytesIO ()
34
34
ghdiff .main ([f1 , f2 ], stdout = out )
35
35
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 )
38
38
39
39
def test_no_css_option (self ):
40
40
"""Simple test for --no-css option"""
@@ -43,7 +43,7 @@ def test_no_css_option(self):
43
43
out = io .BytesIO ()
44
44
ghdiff .main ([f1 , f2 , "--no-css" ], stdout = out )
45
45
output = out .getvalue ()
46
- self .assertFalse ("<style" in output )
46
+ self .assertFalse (b "<style" in output )
47
47
48
48
49
49
def test_suite ():
You can’t perform that action at this time.
0 commit comments