source: trunk/essentials/dev-lang/python/Misc/Vim/syntax_test.py@ 3400

Last change on this file since 3400 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 1.5 KB
Line 
1"""Test file for syntax highlighting of editors.
2
3Meant to cover a wide range of different types of statements and expressions.
4Not 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.
10
11"""
12# Comment
13# OPTIONAL: XXX catch your attention
14
15# Statements
16from __future__ import with_statement # Import
17from sys import path as thing
18assert True # keyword
19def foo(): # function definition
20 return []
21class Bar(object): # Class definition
22 def __enter__(self):
23 pass
24 def __exit__(self, *args):
25 pass
26foo() # UNCOLOURED: function call
27while False: # 'while'
28 continue
29for x in foo(): # 'for'
30 break
31with Bar() as stuff:
32 pass
33if False: pass # 'if'
34elif False: pass
35else: 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'''
42r'raw'
43ur'unicode raw'
44'escape\n'
45'\04' # octal
46'\xFF' # hex
47'\u1111' # unicode character
481 # Integral
491L
501.0 # Float
51.1
521+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
Note: See TracBrowser for help on using the repository browser.