| Line | |
|---|
| 1 | """Test file for syntax highlighting of editors.
|
|---|
| 2 |
|
|---|
| 3 | Meant to cover a wide range of different types of statements and expressions.
|
|---|
| 4 | Not necessarily sensical or comprehensive (assume that if one exception is
|
|---|
| 5 | highlighted that all are, for instance).
|
|---|
| 6 |
|
|---|
| 7 | Highlighting extraneous whitespace at the end of the line is not represented
|
|---|
| 8 | here as all trailing whitespace is automatically removed from .py files in the
|
|---|
| 9 | repository.
|
|---|
| 10 |
|
|---|
| 11 | """
|
|---|
| 12 | # Comment
|
|---|
| 13 | # OPTIONAL: XXX catch your attention
|
|---|
| 14 |
|
|---|
| 15 | # Statements
|
|---|
| 16 | from __future__ import with_statement # Import
|
|---|
| 17 | from sys import path as thing
|
|---|
| 18 | assert True # keyword
|
|---|
| 19 | def foo(): # function definition
|
|---|
| 20 | return []
|
|---|
| 21 | class Bar(object): # Class definition
|
|---|
| 22 | def __enter__(self):
|
|---|
| 23 | pass
|
|---|
| 24 | def __exit__(self, *args):
|
|---|
| 25 | pass
|
|---|
| 26 | foo() # UNCOLOURED: function call
|
|---|
| 27 | while False: # 'while'
|
|---|
| 28 | continue
|
|---|
| 29 | for x in foo(): # 'for'
|
|---|
| 30 | break
|
|---|
| 31 | with Bar() as stuff:
|
|---|
| 32 | pass
|
|---|
| 33 | if False: pass # 'if'
|
|---|
| 34 | elif False: pass
|
|---|
| 35 | else: pass
|
|---|
| 36 |
|
|---|
| 37 | # Constants
|
|---|
| 38 | 'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted
|
|---|
| 39 | "double-quote"
|
|---|
| 40 | """triple double-quote"""
|
|---|
| 41 | '''triple single-quote'''
|
|---|
| 42 | r'raw'
|
|---|
| 43 | ur'unicode raw'
|
|---|
| 44 | 'escape\n'
|
|---|
| 45 | '\04' # octal
|
|---|
| 46 | '\xFF' # hex
|
|---|
| 47 | '\u1111' # unicode character
|
|---|
| 48 | 1 # Integral
|
|---|
| 49 | 1L
|
|---|
| 50 | 1.0 # Float
|
|---|
| 51 | .1
|
|---|
| 52 | 1+2j # Complex
|
|---|
| 53 |
|
|---|
| 54 | # Expressions
|
|---|
| 55 | 1 and 2 or 3 # Boolean operators
|
|---|
| 56 | 2 < 3 # UNCOLOURED: comparison operators
|
|---|
| 57 | spam = 42 # UNCOLOURED: assignment
|
|---|
| 58 | 2 + 3 # UNCOLOURED: number operators
|
|---|
| 59 | [] # UNCOLOURED: list
|
|---|
| 60 | {} # UNCOLOURED: dict
|
|---|
| 61 | (1,) # UNCOLOURED: tuple
|
|---|
| 62 | all # Built-in functions
|
|---|
| 63 | GeneratorExit # Exceptions
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.