63 lines · 1.5 KB · Python
RawDownload
"""Test file for syntax highlighting of editors. Meant to cover a wide range of different types of statements and expressions.Not necessarily sensical or comprehensive (assume that if one exception ishighlighted that all are, for instance). Highlighting extraneous whitespace at the end of the line is not representedhere as all trailing whitespace is automatically removed from .py files in therepository. """# Comment# OPTIONAL: XXX catch your attention # Statementsfrom __future__ import with_statement  # Importfrom sys import path as thingassert True # keyworddef foo():  # function definition    return []class Bar(object):  # Class definition    def __enter__(self):        pass    def __exit__(self, *args):        passfoo()  # UNCOLOURED: function callwhile False:  # 'while'    continuefor x in foo():  # 'for'    breakwith Bar() as stuff:    passif False: pass  # 'if'elif False: passelse: pass # Constants'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted"double-quote""""triple double-quote"""'''triple single-quote'''r'raw'ur'unicode raw''escape\n''\04'  # octal'\xFF' # hex'\u1111' # unicode character1  # Integral1L1.0  # Float.11+2j  # Complex # Expressions1 and 2 or 3  # Boolean operators2 < 3  # UNCOLOURED: comparison operatorsspam = 42  # UNCOLOURED: assignment2 + 3  # UNCOLOURED: number operators[]  # UNCOLOURED: list{}  # UNCOLOURED: dict(1,)  # UNCOLOURED: tupleall  # Built-in functionsGeneratorExit  # Exceptions