source: python/trunk/Misc/Vim/syntax_test.py

Last change on this file was 2, checked in by Yuri Dario, 15 years ago

Initial import for vendor code.

  • Property svn:eol-style set to native
File size: 1.4 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
7Extraneous trailing whitespace can't be tested because of svn pre-commit hook
8checks for such things.
9
10"""
11# Comment
12# OPTIONAL: XXX catch your attention
13
14# Statements
15from __future__ import with_statement # Import
16from sys import path as thing
17assert True # keyword
18def foo(): # function definition
19 return []
20class Bar(object): # Class definition
21 def __enter__(self):
22 pass
23 def __exit__(self, *args):
24 pass
25foo() # UNCOLOURED: function call
26while False: # 'while'
27 continue
28for x in foo(): # 'for'
29 break
30with Bar() as stuff:
31 pass
32if False: pass # 'if'
33elif False: pass
34else: pass
35
36# Constants
37'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted
38"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
471 # Integral
481L
491.0 # Float
50.1
511+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
Note: See TracBrowser for help on using the repository browser.