diff -r bf5f777260a6 -r 21b0534faebc eric6/ThirdParty/Pygments/pygments/formatters/other.py --- a/eric6/ThirdParty/Pygments/pygments/formatters/other.py Tue Apr 21 19:44:19 2020 +0200 +++ b/eric6/ThirdParty/Pygments/pygments/formatters/other.py Tue Apr 21 19:47:10 2020 +0200 @@ -5,12 +5,12 @@ Other formatters: NullFormatter, RawTokenFormatter. - :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. """ from pygments.formatter import Formatter -from pygments.util import OptionError, get_choice_opt +from pygments.util import get_choice_opt from pygments.token import Token from pygments.console import colorize @@ -87,14 +87,17 @@ if self.compress == 'gz': import gzip outfile = gzip.GzipFile('', 'wb', 9, outfile) + def write(text): outfile.write(text.encode()) flush = outfile.flush elif self.compress == 'bz2': import bz2 compressor = bz2.BZ2Compressor(9) + def write(text): outfile.write(compressor.compress(text.encode())) + def flush(): outfile.write(compressor.flush()) outfile.flush() @@ -115,14 +118,15 @@ write("%s\t%r\n" % (ttype, value)) flush() + TESTCASE_BEFORE = u'''\ - def testNeedsName(self): + def testNeedsName(lexer): fragment = %r tokens = [ ''' TESTCASE_AFTER = u'''\ ] - self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) + assert list(lexer.get_tokens(fragment)) == tokens '''