summaryrefslogtreecommitdiff
path: root/tests/test_html_formatter.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_html_formatter.py')
-rw-r--r--tests/test_html_formatter.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py
index 79990edd..37efd6f0 100644
--- a/tests/test_html_formatter.py
+++ b/tests/test_html_formatter.py
@@ -3,7 +3,7 @@
Pygments HTML formatter tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -100,7 +100,7 @@ class HtmlFormatterTest(unittest.TestCase):
fmt = HtmlFormatter(**optdict)
fmt.format(tokensource, outfile)
html = outfile.getvalue()
- self.assertTrue(re.search("<pre>\s+1\s+2\s+3", html))
+ self.assertTrue(re.search(r"<pre>\s+1\s+2\s+3", html))
def test_linenos_with_startnum(self):
optdict = dict(linenos=True, linenostart=5)
@@ -108,7 +108,7 @@ class HtmlFormatterTest(unittest.TestCase):
fmt = HtmlFormatter(**optdict)
fmt.format(tokensource, outfile)
html = outfile.getvalue()
- self.assertTrue(re.search("<pre>\s+5\s+6\s+7", html))
+ self.assertTrue(re.search(r"<pre>\s+5\s+6\s+7", html))
def test_lineanchors(self):
optdict = dict(lineanchors="foo")
@@ -132,9 +132,8 @@ class HtmlFormatterTest(unittest.TestCase):
outencoding='utf-8')
handle, pathname = tempfile.mkstemp('.html')
- tfile = os.fdopen(handle, 'w+b')
- fmt.format(tokensource, tfile)
- tfile.close()
+ with os.fdopen(handle, 'w+b') as tfile:
+ fmt.format(tokensource, tfile)
catname = os.path.join(TESTDIR, 'dtds', 'HTML4.soc')
try:
import subprocess
@@ -173,9 +172,8 @@ class HtmlFormatterTest(unittest.TestCase):
cssstyles=u'div:before { content: \'bäz\' }',
encoding='utf-8')
handle, pathname = tempfile.mkstemp('.html')
- tfile = os.fdopen(handle, 'w+b')
- fmt.format(tokensource, tfile)
- tfile.close()
+ with os.fdopen(handle, 'w+b') as tfile:
+ fmt.format(tokensource, tfile)
def test_ctags(self):
try: