blob: 1d208668d065fb569829ae39fa8c6b8b1fba5b19 [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
Christian Heimesfd66e512008-01-29 12:18:50 +00007Extraneous trailing whitespace can't be tested because of svn pre-commit hook
8checks for such things.
Brett Cannona4fe1822006-02-25 14:52:53 +00009
10"""
Brett Cannona4fe1822006-02-25 14:52:53 +000011# Comment
Brett Cannon23b0dc52006-02-26 19:27:29 +000012# OPTIONAL: XXX catch your attention
13
14# Statements
Brett Cannon20e192b2006-03-01 20:53:08 +000015from __future__ import with_statement # Import
16from sys import path as thing
Brett Cannon23b0dc52006-02-26 19:27:29 +000017assert True # keyword
18def foo(): # function definition
19 return []
20class Bar(object): # Class definition
Brett Cannon20e192b2006-03-01 20:53:08 +000021 def __enter__(self):
22 pass
23 def __exit__(self, *args):
24 pass
Brett Cannon23b0dc52006-02-26 19:27:29 +000025foo() # UNCOLOURED: function call
26while False: # 'while'
27 continue
28for x in foo(): # 'for'
29 break
Brett Cannon20e192b2006-03-01 20:53:08 +000030with Bar() as stuff:
31 pass
Brett Cannon23b0dc52006-02-26 19:27:29 +000032if False: pass # 'if'
33elif False: pass
Brett Cannon20e192b2006-03-01 20:53:08 +000034else: pass
Brett Cannon23b0dc52006-02-26 19:27:29 +000035
36# Constants
37'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted
Brett Cannona4fe1822006-02-25 14:52:53 +000038"double-quote"
39"""triple double-quote"""
40'''triple single-quote'''
41r'raw'
42ur'unicode raw'
43'escape\n'
44'\04' # octal
45'\xFF' # hex
46'\u1111' # unicode character
Brett Cannon23b0dc52006-02-26 19:27:29 +0000471 # Integral
Brett Cannona4fe1822006-02-25 14:52:53 +0000481L
Brett Cannon23b0dc52006-02-26 19:27:29 +0000491.0 # Float
Brett Cannona4fe1822006-02-25 14:52:53 +000050.1
Brett Cannon23b0dc52006-02-26 19:27:29 +0000511+2j # Complex
52
53# Expressions
541 and 2 or 3 # Boolean operators
552 < 3 # UNCOLOURED: comparison operators
56spam = 42 # UNCOLOURED: assignment
572 + 3 # UNCOLOURED: number operators
58[] # UNCOLOURED: list
59{} # UNCOLOURED: dict
60(1,) # UNCOLOURED: tuple
61all # Built-in functions
62GeneratorExit # Exceptions