1616from pathlib import Path
1717
1818import pypandoc
19- from pypandoc .py3compat import path2url , string_types , unicode_type
19+ from pypandoc .py3compat import path2url
2020
2121
2222@contextlib .contextmanager
@@ -53,7 +53,7 @@ def closed_tempfile(suffix, text=None, dir_name=None, prefix=None):
5353# Stolen from pandas
5454def is_list_like (arg ):
5555 return (hasattr (arg , '__iter__' ) and
56- not isinstance (arg , string_types ))
56+ not isinstance (arg , str ))
5757
5858
5959@contextlib .contextmanager
@@ -129,10 +129,6 @@ def assert_produces_warning(expected_warning=Warning, filter_level="always",
129129
130130class TestPypandoc (unittest .TestCase ):
131131
132- # Python 2 compatibility
133- if not hasattr (unittest .TestCase , 'assertRaisesRegex' ):
134- assertRaisesRegex = unittest .TestCase .assertRaisesRegexp
135-
136132 def setUp (self ):
137133 if 'HOME' not in os .environ :
138134 # if this is used with older versions of pandoc-citeproc
@@ -155,7 +151,7 @@ def test_get_pandoc_formats(self):
155151 def test_get_pandoc_version (self ):
156152 assert "HOME" in os .environ , "No HOME set, this will error..."
157153 version = pypandoc .get_pandoc_version ()
158- self .assertTrue (isinstance (version , pypandoc . string_types ))
154+ self .assertTrue (isinstance (version , str ))
159155 major = int (version .split ("." )[0 ])
160156 self .assertTrue (major in [0 , 1 , 2 , 3 ])
161157
@@ -524,12 +520,12 @@ def test_unicode_input(self):
524520 # make sure that pandoc always returns unicode and does not mishandle it
525521 expected = u'üäöîôû{0}' .format (os .linesep )
526522 written = pypandoc .convert_text (u'<p>üäöîôû</p>' , 'md' , format = 'html' )
527- self .assertTrue (isinstance (written , unicode_type ))
523+ self .assertTrue (isinstance (written , str ))
528524 self .assertEqualExceptForNewlineEnd (expected , written )
529525 bytes = u'<p>üäöîôû</p>' .encode ("utf-8" )
530526 written = pypandoc .convert_text (bytes , 'md' , format = 'html' )
531527 self .assertTrue (expected == written )
532- self .assertTrue (isinstance (written , unicode_type ))
528+ self .assertTrue (isinstance (written , str ))
533529
534530 # Only use german umlauts in the next test, as iso-8859-15 covers that
535531 expected = u'äüäö{0}' .format (os .linesep )
@@ -550,7 +546,7 @@ def f():
550546 # with the right encoding it should work...
551547 written = pypandoc .convert_text (bytes , 'md' , format = 'html' , encoding = "iso-8859-15" )
552548 self .assertEqualExceptForNewlineEnd (expected , written )
553- self .assertTrue (isinstance (written , unicode_type ))
549+ self .assertTrue (isinstance (written , str ))
554550
555551 def test_conversion_from_non_plain_text_file (self ):
556552 with closed_tempfile ('.docx' ) as file_name :
0 commit comments