2006-02-25 10:52:53 -04:00
|
|
|
"""Test file for syntax highlighting of editors.
|
|
|
|
|
|
|
|
Meant to cover a wide range of different types of statements and expressions.
|
2006-02-26 15:27:29 -04:00
|
|
|
Not necessarily sensical or comprehensive (assume that if one exception is
|
|
|
|
highlighted that all are, for instance).
|
|
|
|
|
2008-01-29 00:18:04 -04:00
|
|
|
Extraneous trailing whitespace can't be tested because of svn pre-commit hook
|
|
|
|
checks for such things.
|
2006-02-25 10:52:53 -04:00
|
|
|
|
|
|
|
"""
|
|
|
|
# Comment
|
2006-02-26 15:27:29 -04:00
|
|
|
# OPTIONAL: XXX catch your attention
|
|
|
|
|
|
|
|
# Statements
|
2006-03-01 16:53:08 -04:00
|
|
|
from __future__ import with_statement # Import
|
|
|
|
from sys import path as thing
|
2006-02-26 15:27:29 -04:00
|
|
|
assert True # keyword
|
|
|
|
def foo(): # function definition
|
|
|
|
return []
|
|
|
|
class Bar(object): # Class definition
|
2006-03-01 16:53:08 -04:00
|
|
|
def __enter__(self):
|
|
|
|
pass
|
|
|
|
def __exit__(self, *args):
|
|
|
|
pass
|
2006-02-26 15:27:29 -04:00
|
|
|
foo() # UNCOLOURED: function call
|
|
|
|
while False: # 'while'
|
|
|
|
continue
|
|
|
|
for x in foo(): # 'for'
|
|
|
|
break
|
2006-03-01 16:53:08 -04:00
|
|
|
with Bar() as stuff:
|
|
|
|
pass
|
2006-02-26 15:27:29 -04:00
|
|
|
if False: pass # 'if'
|
|
|
|
elif False: pass
|
2006-03-01 16:53:08 -04:00
|
|
|
else: pass
|
2006-02-26 15:27:29 -04:00
|
|
|
|
|
|
|
# Constants
|
|
|
|
'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted
|
2006-02-25 10:52:53 -04:00
|
|
|
"double-quote"
|
|
|
|
"""triple double-quote"""
|
|
|
|
'''triple single-quote'''
|
|
|
|
r'raw'
|
|
|
|
ur'unicode raw'
|
|
|
|
'escape\n'
|
|
|
|
'\04' # octal
|
|
|
|
'\xFF' # hex
|
|
|
|
'\u1111' # unicode character
|
2006-02-26 15:27:29 -04:00
|
|
|
1 # Integral
|
2006-02-25 10:52:53 -04:00
|
|
|
1L
|
2006-02-26 15:27:29 -04:00
|
|
|
1.0 # Float
|
2006-02-25 10:52:53 -04:00
|
|
|
.1
|
2006-02-26 15:27:29 -04:00
|
|
|
1+2j # Complex
|
|
|
|
|
|
|
|
# Expressions
|
|
|
|
1 and 2 or 3 # Boolean operators
|
|
|
|
2 < 3 # UNCOLOURED: comparison operators
|
|
|
|
spam = 42 # UNCOLOURED: assignment
|
|
|
|
2 + 3 # UNCOLOURED: number operators
|
|
|
|
[] # UNCOLOURED: list
|
|
|
|
{} # UNCOLOURED: dict
|
|
|
|
(1,) # UNCOLOURED: tuple
|
|
|
|
all # Built-in functions
|
|
|
|
GeneratorExit # Exceptions
|