11"""Test file for syntax highlighting of editors.
22
33Meant to cover a wide range of different types of statements and expressions.
4- Not necessarily sensical.
4+ Not necessarily sensical or comprehensive (assume that if one exception is
5+ highlighted that all are, for instance).
6+
7+ Highlighting extraneous whitespace at the end of the line is not represented
8+ here as all trailing whitespace is automatically removed from .py files in the
9+ repository.
510
611"""
7- assert True
8- def foo (): pass
9- foo () # Uncoloured
10- while False : pass
11- 1 and 2
12- if False : pass
13- from sys import path
1412# Comment
15- # XXX catch your attention
16- 'single-quote' , u'unicode'
13+ # OPTIONAL: XXX catch your attention
14+
15+ # Statements
16+ assert True # keyword
17+ def foo (): # function definition
18+ return []
19+ class Bar (object ): # Class definition
20+ pass
21+ foo () # UNCOLOURED: function call
22+ while False : # 'while'
23+ continue
24+ for x in foo (): # 'for'
25+ break
26+ if False : pass # 'if'
27+ elif False : pass
28+ else False : pass
29+ from sys import path as thing # Import
30+
31+ # Constants
32+ 'single-quote' , u'unicode' # Strings of all kinds; prefixes not highlighted
1733"double-quote"
1834"""triple double-quote"""
1935'''triple single-quote'''
@@ -23,14 +39,19 @@ def foo(): pass
2339'\04 ' # octal
2440'\xFF ' # hex
2541'\u1111 ' # unicode character
26- 1
42+ 1 # Integral
27431L
28- 1.0
44+ 1.0 # Float
2945.1
30- 1 + 2j
31- [] # Uncoloured
32- {} # Uncoloured
33- () # Uncoloured
34- all
35- GeneratorExit
36- trailing_whitespace = path
46+ 1 + 2j # Complex
47+
48+ # Expressions
49+ 1 and 2 or 3 # Boolean operators
50+ 2 < 3 # UNCOLOURED: comparison operators
51+ spam = 42 # UNCOLOURED: assignment
52+ 2 + 3 # UNCOLOURED: number operators
53+ [] # UNCOLOURED: list
54+ {} # UNCOLOURED: dict
55+ (1 ,) # UNCOLOURED: tuple
56+ all # Built-in functions
57+ GeneratorExit # Exceptions
0 commit comments