blob: ccc7f309c611121e31dccaa66915a26e944f44f1 [file] [log] [blame]
Brett Cannona4fe1822006-02-25 14:52:53 +00001"""Test file for syntax highlighting of editors.
2
3Meant to cover a wide range of different types of statements and expressions.
Brett Cannon23b0dc52006-02-26 19:27:29 +00004Not necessarily sensical or comprehensive (assume that if one exception is
5highlighted that all are, for instance).
6
7Highlighting extraneous whitespace at the end of the line is not represented
8here as all trailing whitespace is automatically removed from .py files in the
9repository.
Brett Cannona4fe1822006-02-25 14:52:53 +000010
11"""
Brett Cannona4fe1822006-02-25 14:52:53 +000012# Comment
Brett Cannon23b0dc52006-02-26 19:27:29 +000013# OPTIONAL: XXX catch your attention
14
15# Statements
Brett Cannon20e192b2006-03-01 20:53:08 +000016from __future__ import with_statement # Import
17from sys import path as thing
Brett Cannon23b0dc52006-02-26 19:27:29 +000018assert True # keyword
19def foo(): # function definition
20 return []
21class Bar(object): # Class definition
Brett Cannon20e192b2006-03-01 20:53:08 +000022 def __enter__(self):
23 pass
24 def __exit__(self, *args):
25 pass
Brett Cannon23b0dc52006-02-26 19:27:29 +000026foo() # UNCOLOURED: function call
27while False: # 'while'
28 continue
29for x in foo(): # 'for'
30 break
Brett Cannon20e192b2006-03-01 20:53:08 +000031with Bar() as stuff:
32 pass
Brett Cannon23b0dc52006-02-26 19:27:29 +000033if False: pass # 'if'
34elif False: pass
Brett Cannon20e192b2006-03-01 20:53:08 +000035else: pass
Brett Cannon23b0dc52006-02-26 19:27:29 +000036
37# Constants
38'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted
Brett Cannona4fe1822006-02-25 14:52:53 +000039"double-quote"
40"""triple double-quote"""
41'''triple single-quote'''
42r'raw'
43ur'unicode raw'
44'escape\n'
45'\04' # octal
46'\xFF' # hex
47'\u1111' # unicode character
Brett Cannon23b0dc52006-02-26 19:27:29 +0000481 # Integral
Brett Cannona4fe1822006-02-25 14:52:53 +0000491L
Brett Cannon23b0dc52006-02-26 19:27:29 +0000501.0 # Float
Brett Cannona4fe1822006-02-25 14:52:53 +000051.1
Brett Cannon23b0dc52006-02-26 19:27:29 +0000521+2j # Complex
53
54# Expressions
551 and 2 or 3 # Boolean operators
562 < 3 # UNCOLOURED: comparison operators
57spam = 42 # UNCOLOURED: assignment
582 + 3 # UNCOLOURED: number operators
59[] # UNCOLOURED: list
60{} # UNCOLOURED: dict
61(1,) # UNCOLOURED: tuple
62all # Built-in functions
63GeneratorExit # Exceptions