diff --git a/lib/matplotlib/sphinxext/tests/test_tinypages.py b/lib/matplotlib/sphinxext/tests/test_tinypages.py index 1b1834f478c..ae464a6c12e 100644 --- a/lib/matplotlib/sphinxext/tests/test_tinypages.py +++ b/lib/matplotlib/sphinxext/tests/test_tinypages.py @@ -80,11 +80,11 @@ def plot_file(num): # Plot 13 shows close-figs in action assert_true(file_same(range_4, plot_file(13))) # Plot 14 has included source - with open(pjoin(self.html_dir, 'some_plots.html'), 'rt') as fobj: + with open(pjoin(self.html_dir, 'some_plots.html'), 'rb') as fobj: html_contents = fobj.read() - assert_true('# Only a comment' in html_contents) + assert_true(b'# Only a comment' in html_contents) # check plot defined in external file. assert_true(file_same(range_4, pjoin(self.html_dir, 'range4.png'))) assert_true(file_same(range_6, pjoin(self.html_dir, 'range6.png'))) # check if figure caption made it into html file - assert_true('This is the caption for plot 15.' in html_contents) + assert_true(b'This is the caption for plot 15.' in html_contents)