From 8d2d68790b6931833277cd671dfb8158962fac0c Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Sat, 11 Sep 2010 11:27:26 +0200 Subject: Reorganize the test suite in order to check more failures with fewer test files. --HG-- rename : testsuite/E101.py => testsuite/E10.py rename : testsuite/E111.py => testsuite/E11.py rename : testsuite/E202not.py => testsuite/E20.py rename : testsuite/E211not.py => testsuite/E21.py rename : testsuite/E225not.py => testsuite/E22.py rename : testsuite/E231.py => testsuite/E23.py rename : testsuite/E241.py => testsuite/E24.py rename : testsuite/E251.py => testsuite/E25.py rename : testsuite/E261.py => testsuite/E26.py rename : testsuite/E301.py => testsuite/E30.py rename : testsuite/E301not.py => testsuite/E30not.py rename : testsuite/E401.py => testsuite/E40.py rename : testsuite/E501.py => testsuite/E50.py rename : testsuite/E701.py => testsuite/E70.py rename : testsuite/W191.py => testsuite/W19.py rename : testsuite/W292.py => testsuite/W29.py rename : testsuite/W391.py => testsuite/W39.py rename : testsuite/W601.py => testsuite/W60.py rename : testsuite/E113not.py => testsuite/latin-1.py rename : testsuite/E501not.py => testsuite/utf-8.py --- CHANGES.txt | 4 ++ pep8.py | 113 ++++++++++++++++++++++++++++++++++-------------- testsuite/E10.py | 5 +++ testsuite/E101.py | 4 -- testsuite/E11.py | 12 ++++++ testsuite/E111.py | 2 - testsuite/E111b.py | 2 - testsuite/E112.py | 2 - testsuite/E113.py | 2 - testsuite/E113not.py | 6 --- testsuite/E20.py | 55 ++++++++++++++++++++++++ testsuite/E201.py | 1 - testsuite/E201b.py | 1 - testsuite/E201c.py | 1 - testsuite/E201not.py | 1 - testsuite/E202.py | 1 - testsuite/E202b.py | 1 - testsuite/E202c.py | 1 - testsuite/E202not.py | 16 ------- testsuite/E203.py | 1 - testsuite/E203b.py | 1 - testsuite/E203c.py | 1 - testsuite/E203not.py | 3 -- testsuite/E21.py | 17 ++++++++ testsuite/E211.py | 1 - testsuite/E211b.py | 1 - testsuite/E211c.py | 1 - testsuite/E211not.py | 12 ------ testsuite/E22.py | 87 +++++++++++++++++++++++++++++++++++++ testsuite/E221.py | 2 - testsuite/E221b.py | 3 -- testsuite/E221c.py | 3 -- testsuite/E221d.py | 3 -- testsuite/E221not.py | 3 -- testsuite/E222.py | 2 - testsuite/E222b.py | 3 -- testsuite/E222c.py | 3 -- testsuite/E223.py | 2 - testsuite/E224.py | 2 - testsuite/E225.py | 1 - testsuite/E225a.py | 1 - testsuite/E225b.py | 1 - testsuite/E225c.py | 1 - testsuite/E225d.py | 1 - testsuite/E225e.py | 1 - testsuite/E225f.py | 1 - testsuite/E225g.py | 1 - testsuite/E225h.py | 1 - testsuite/E225i.py | 2 - testsuite/E225not.py | 15 ------- testsuite/E23.py | 12 ++++++ testsuite/E231.py | 1 - testsuite/E231b.py | 1 - testsuite/E231not.py | 8 ---- testsuite/E24.py | 6 +++ testsuite/E241.py | 2 - testsuite/E242.py | 2 - testsuite/E25.py | 15 +++++++ testsuite/E251.py | 3 -- testsuite/E251b.py | 1 - testsuite/E251c.py | 1 - testsuite/E251d.py | 1 - testsuite/E251not.py | 5 --- testsuite/E26.py | 6 +++ testsuite/E261.py | 1 - testsuite/E262.py | 1 - testsuite/E262b.py | 1 - testsuite/E30.py | 66 ++++++++++++++++++++++++++++ testsuite/E301.py | 6 --- testsuite/E301b.py | 7 --- testsuite/E301not.py | 59 -------------------------- testsuite/E302.py | 5 --- testsuite/E302b.py | 7 --- testsuite/E302not.py | 36 ---------------- testsuite/E303.py | 5 --- testsuite/E303b.py | 7 --- testsuite/E303c.py | 7 --- testsuite/E303not.py | 19 --------- testsuite/E304.py | 4 -- testsuite/E30not.py | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++ testsuite/E40.py | 13 ++++++ testsuite/E401.py | 1 - testsuite/E401not.py | 10 ----- testsuite/E50.py | 2 + testsuite/E501.py | 1 - testsuite/E501not.py | 26 ------------ testsuite/E70.py | 4 ++ testsuite/E701.py | 1 - testsuite/E702.py | 1 - testsuite/W19.py | 3 ++ testsuite/W191.py | 2 - testsuite/W29.py | 8 ++++ testsuite/W291.py | 1 - testsuite/W291not.py | 3 -- testsuite/W292.py | 1 - testsuite/W293.py | 3 -- testsuite/W39.py | 3 ++ testsuite/W391.py | 2 - testsuite/W60.py | 10 +++++ testsuite/W601.py | 2 - testsuite/W602.py | 1 - testsuite/W603.py | 2 - testsuite/W604.py | 1 - testsuite/latin-1.py | 6 +++ testsuite/utf-8.py | 26 ++++++++++++ 105 files changed, 558 insertions(+), 395 deletions(-) create mode 100644 testsuite/E10.py delete mode 100644 testsuite/E101.py create mode 100644 testsuite/E11.py delete mode 100644 testsuite/E111.py delete mode 100644 testsuite/E111b.py delete mode 100644 testsuite/E112.py delete mode 100644 testsuite/E113.py delete mode 100644 testsuite/E113not.py create mode 100644 testsuite/E20.py delete mode 100644 testsuite/E201.py delete mode 100644 testsuite/E201b.py delete mode 100644 testsuite/E201c.py delete mode 100644 testsuite/E201not.py delete mode 100644 testsuite/E202.py delete mode 100644 testsuite/E202b.py delete mode 100644 testsuite/E202c.py delete mode 100644 testsuite/E202not.py delete mode 100644 testsuite/E203.py delete mode 100644 testsuite/E203b.py delete mode 100644 testsuite/E203c.py delete mode 100644 testsuite/E203not.py create mode 100644 testsuite/E21.py delete mode 100644 testsuite/E211.py delete mode 100644 testsuite/E211b.py delete mode 100644 testsuite/E211c.py delete mode 100644 testsuite/E211not.py create mode 100644 testsuite/E22.py delete mode 100644 testsuite/E221.py delete mode 100644 testsuite/E221b.py delete mode 100644 testsuite/E221c.py delete mode 100644 testsuite/E221d.py delete mode 100644 testsuite/E221not.py delete mode 100644 testsuite/E222.py delete mode 100644 testsuite/E222b.py delete mode 100644 testsuite/E222c.py delete mode 100644 testsuite/E223.py delete mode 100644 testsuite/E224.py delete mode 100644 testsuite/E225.py delete mode 100644 testsuite/E225a.py delete mode 100644 testsuite/E225b.py delete mode 100644 testsuite/E225c.py delete mode 100644 testsuite/E225d.py delete mode 100644 testsuite/E225e.py delete mode 100644 testsuite/E225f.py delete mode 100644 testsuite/E225g.py delete mode 100644 testsuite/E225h.py delete mode 100644 testsuite/E225i.py delete mode 100644 testsuite/E225not.py create mode 100644 testsuite/E23.py delete mode 100644 testsuite/E231.py delete mode 100644 testsuite/E231b.py delete mode 100644 testsuite/E231not.py create mode 100644 testsuite/E24.py delete mode 100644 testsuite/E241.py delete mode 100644 testsuite/E242.py create mode 100644 testsuite/E25.py delete mode 100644 testsuite/E251.py delete mode 100644 testsuite/E251b.py delete mode 100644 testsuite/E251c.py delete mode 100644 testsuite/E251d.py delete mode 100644 testsuite/E251not.py create mode 100644 testsuite/E26.py delete mode 100644 testsuite/E261.py delete mode 100644 testsuite/E262.py delete mode 100644 testsuite/E262b.py create mode 100644 testsuite/E30.py delete mode 100644 testsuite/E301.py delete mode 100644 testsuite/E301b.py delete mode 100644 testsuite/E301not.py delete mode 100644 testsuite/E302.py delete mode 100644 testsuite/E302b.py delete mode 100644 testsuite/E302not.py delete mode 100644 testsuite/E303.py delete mode 100644 testsuite/E303b.py delete mode 100644 testsuite/E303c.py delete mode 100644 testsuite/E303not.py delete mode 100644 testsuite/E304.py create mode 100644 testsuite/E30not.py create mode 100644 testsuite/E40.py delete mode 100644 testsuite/E401.py delete mode 100644 testsuite/E401not.py create mode 100644 testsuite/E50.py delete mode 100644 testsuite/E501.py delete mode 100644 testsuite/E501not.py create mode 100644 testsuite/E70.py delete mode 100644 testsuite/E701.py delete mode 100644 testsuite/E702.py create mode 100644 testsuite/W19.py delete mode 100644 testsuite/W191.py create mode 100644 testsuite/W29.py delete mode 100644 testsuite/W291.py delete mode 100644 testsuite/W291not.py delete mode 100644 testsuite/W292.py delete mode 100644 testsuite/W293.py create mode 100644 testsuite/W39.py delete mode 100644 testsuite/W391.py create mode 100644 testsuite/W60.py delete mode 100644 testsuite/W601.py delete mode 100644 testsuite/W602.py delete mode 100644 testsuite/W603.py delete mode 100644 testsuite/W604.py create mode 100644 testsuite/latin-1.py create mode 100644 testsuite/utf-8.py diff --git a/CHANGES.txt b/CHANGES.txt index fb14047..5de9d3a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,10 @@ Changelog 0.5.1 (unreleased) ------------------ +* Test suite reorganized and enhanced in order to check more failures + with fewer test files. Read the ``run_tests`` docstring for details + about the syntax. + * Fix E225: accept ``print >>sys.stderr, "..."`` syntax. * Fix E501 for lines containing multibyte encoded characters. (Issue #7) diff --git a/pep8.py b/pep8.py index f384069..227a9a3 100755 --- a/pep8.py +++ b/pep8.py @@ -818,13 +818,15 @@ class Checker(object): Load a Python source file, tokenize it, check coding style. """ - def __init__(self, filename): - if filename: - self.filename = filename + def __init__(self, filename, lines=None): + self.filename = filename + if filename is None: + self.filename = 'stdin' + self.lines = lines or [] + elif lines is None: self.lines = readlines(filename) else: - self.filename = 'stdin' - self.lines = [] + self.lines = lines options.counters['physical lines'] += len(self.lines) def readline(self): @@ -933,12 +935,14 @@ class Checker(object): text, check) self.previous_logical = self.logical_line - def check_all(self): + def check_all(self, expected=None, line_offset=0): """ Run all checks on the input file. """ - self.file_errors = 0 + self.expected = expected or () + self.line_offset = line_offset self.line_number = 0 + self.file_errors = 0 self.indent_char = None self.indent_level = 0 self.previous_logical = '' @@ -993,23 +997,19 @@ class Checker(object): return if options.quiet == 1 and not self.file_errors: message(self.filename) - self.file_errors += 1 if code in options.counters: options.counters[code] += 1 else: options.counters[code] = 1 options.messages[code] = text[5:] - if options.quiet: + if options.quiet or code in self.expected: + # Don't care about expected errors or warnings return - if options.testsuite: - basename = os.path.basename(self.filename) - if basename[:4] != code: - return # Don't care about other errors or warnings - if 'not' not in basename: - return # Don't print the expected error message + self.file_errors += 1 if options.counters[code] == 1 or options.repeat: message("%s:%s:%d: %s" % - (self.filename, line_number, offset + 1, text)) + (self.filename, self.line_offset + line_number, + offset + 1, text)) if options.show_source: line = self.lines[line_number - 1] message(line.rstrip()) @@ -1022,29 +1022,20 @@ def input_file(filename): """ Run all checks on a Python source file. """ - if excluded(filename): - return {} if options.verbose: message('checking ' + filename) - options.counters['files'] += 1 errors = Checker(filename).check_all() - if options.testsuite: # Check if the expected error was found - basename = os.path.basename(filename) - code = basename[:4] - count = options.counters.get(code, 0) - if count == 0 and 'not' not in basename: - message("%s: error %s not found" % (filename, code)) - # Keep showing errors for multiple tests - reset_counters() -def input_dir(dirname): +def input_dir(dirname, runner=None): """ Check all Python source files in this directory and all subdirectories. """ dirname = dirname.rstrip('/') if excluded(dirname): return + if runner is None: + runner = input_file for root, dirs, files in os.walk(dirname): if options.verbose: message('directory ' + root) @@ -1055,8 +1046,9 @@ def input_dir(dirname): dirs.remove(subdir) files.sort() for filename in files: - if filename_match(filename): - input_file(os.path.join(root, filename)) + if filename_match(filename) and not excluded(filename): + options.counters['files'] += 1 + runner(os.path.join(root, filename)) def excluded(filename): @@ -1158,6 +1150,56 @@ def print_benchmark(elapsed): options.counters[key])) +def run_tests(filename): + """ + Run all the tests from a file. + + A test file can provide many tests. Each test starts with a declaration. + This declaration is a single line starting with '#:'. + It declares codes of expected failures, separated by spaces or 'Okay' + if no failure is expected. + If the file does not contain such declaration, it should pass all tests. + If the declaration is empty, following lines are not checked, until next + declaration. + + Examples: + + * Only E224 and W701 are expected: #: E224 W701 + * Following example is conform: #: Okay + * Don't check these lines: #: + """ + lines = readlines(filename) + ['#:\n'] + line_offset = 0 + codes = ['Okay'] + testcase = [] + for index, line in enumerate(lines): + if not line.startswith('#:'): + if codes: + # Collect the lines of the test case + testcase.append(line) + continue + if codes and index > 0: + label = '%s:%s:1' % (filename, line_offset + 1) + codes = [c for c in codes if c != 'Okay'] + # Run the checker + errors = Checker(filename, testcase).check_all(codes, line_offset) + # Check if the expected errors were found + for code in codes: + if not options.counters.get(code): + errors += 1 + message('%s: error %s not found' % (label, code)) + if options.verbose and not errors: + message('%s: passed (%s)' % (label, ' '.join(codes))) + # Keep showing errors for multiple tests + reset_counters() + # output the real line numbers + line_offset = index + # configure the expected errors + codes = line.split()[1:] + # empty the test case buffer + del testcase[:] + + def selftest(): """ Test all check functions with test cases in docstrings. @@ -1291,12 +1333,17 @@ def _main(): import doctest doctest.testmod(verbose=options.verbose) selftest() + if options.testsuite: + runner = run_tests + else: + runner = input_file start_time = time.time() for path in args: if os.path.isdir(path): - input_dir(path) - else: - input_file(path) + input_dir(path, runner=runner) + elif not excluded(path): + options.counters['files'] += 1 + runner(path) elapsed = time.time() - start_time if options.statistics: print_statistics() diff --git a/testsuite/E10.py b/testsuite/E10.py new file mode 100644 index 0000000..784b59a --- /dev/null +++ b/testsuite/E10.py @@ -0,0 +1,5 @@ +#: E101 W191 +for a in 'abc': + for b in 'xyz': + print a # indented with 8 spaces + print b # indented with 1 tab diff --git a/testsuite/E101.py b/testsuite/E101.py deleted file mode 100644 index 6d1df2f..0000000 --- a/testsuite/E101.py +++ /dev/null @@ -1,4 +0,0 @@ -for a in 'abc': - for b in 'xyz': - print a # indented with 8 spaces - print b # indented with 1 tab diff --git a/testsuite/E11.py b/testsuite/E11.py new file mode 100644 index 0000000..8735e25 --- /dev/null +++ b/testsuite/E11.py @@ -0,0 +1,12 @@ +#: E111 +if x > 2: + print x +#: E111 +if True: + print +#: E112 +if False: +print +#: E113 +print + print diff --git a/testsuite/E111.py b/testsuite/E111.py deleted file mode 100644 index 7ac697b..0000000 --- a/testsuite/E111.py +++ /dev/null @@ -1,2 +0,0 @@ -if x > 2: - print x diff --git a/testsuite/E111b.py b/testsuite/E111b.py deleted file mode 100644 index 262f467..0000000 --- a/testsuite/E111b.py +++ /dev/null @@ -1,2 +0,0 @@ -if True: - print diff --git a/testsuite/E112.py b/testsuite/E112.py deleted file mode 100644 index 9aa3bc0..0000000 --- a/testsuite/E112.py +++ /dev/null @@ -1,2 +0,0 @@ -if False: -print diff --git a/testsuite/E113.py b/testsuite/E113.py deleted file mode 100644 index 5cb18ca..0000000 --- a/testsuite/E113.py +++ /dev/null @@ -1,2 +0,0 @@ -print - print diff --git a/testsuite/E113not.py b/testsuite/E113not.py deleted file mode 100644 index adc0007..0000000 --- a/testsuite/E113not.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: latin-1 -*- -# Test non-UTF8 encoding, along with E113 -latin1 = ('' - '') - -c = ("w") diff --git a/testsuite/E20.py b/testsuite/E20.py new file mode 100644 index 0000000..5bdfea2 --- /dev/null +++ b/testsuite/E20.py @@ -0,0 +1,55 @@ +#: E201 +spam( ham[1], {eggs: 2}) +#: E201 +spam(ham[ 1], {eggs: 2}) +#: E201 +spam(ham[1], { eggs: 2}) +#: Okay +spam(ham[1], {eggs: 2}) +#: + + +#: E202 +spam(ham[1], {eggs: 2} ) +#: E202 +spam(ham[1], {eggs: 2 }) +#: E202 +spam(ham[1 ], {eggs: 2}) +#: Okay +spam(ham[1], {eggs: 2}) + +result = func( + arg1='some value', + arg2='another value', +) + +result = func( + arg1='some value', + arg2='another value' +) + +result = [ + item for item in items + if item > 5 +] +#: + + +#: E203 +if x == 4 : + print x, y + x, y = y, x +#: E203 E702 +if x == 4: + print x, y ; x, y = y, x +#: E203 +if x == 4: + print x, y + x, y = y , x +#: Okay +if x == 4: + print x, y + x, y = y, x +a[b1, :] == a[b1, ...] +b = a[:, b1] +#: diff --git a/testsuite/E201.py b/testsuite/E201.py deleted file mode 100644 index f60ae9c..0000000 --- a/testsuite/E201.py +++ /dev/null @@ -1 +0,0 @@ -spam( ham[1], {eggs: 2}) diff --git a/testsuite/E201b.py b/testsuite/E201b.py deleted file mode 100644 index e0415fe..0000000 --- a/testsuite/E201b.py +++ /dev/null @@ -1 +0,0 @@ -spam(ham[ 1], {eggs: 2}) diff --git a/testsuite/E201c.py b/testsuite/E201c.py deleted file mode 100644 index 715f3fc..0000000 --- a/testsuite/E201c.py +++ /dev/null @@ -1 +0,0 @@ -spam(ham[1], { eggs: 2}) diff --git a/testsuite/E201not.py b/testsuite/E201not.py deleted file mode 100644 index 3637e74..0000000 --- a/testsuite/E201not.py +++ /dev/null @@ -1 +0,0 @@ -spam(ham[1], {eggs: 2}) diff --git a/testsuite/E202.py b/testsuite/E202.py deleted file mode 100644 index 42b9ee4..0000000 --- a/testsuite/E202.py +++ /dev/null @@ -1 +0,0 @@ -spam(ham[1], {eggs: 2} ) diff --git a/testsuite/E202b.py b/testsuite/E202b.py deleted file mode 100644 index e72c3d4..0000000 --- a/testsuite/E202b.py +++ /dev/null @@ -1 +0,0 @@ -spam(ham[1], {eggs: 2 }) diff --git a/testsuite/E202c.py b/testsuite/E202c.py deleted file mode 100644 index b9c3782..0000000 --- a/testsuite/E202c.py +++ /dev/null @@ -1 +0,0 @@ -spam(ham[1 ], {eggs: 2}) diff --git a/testsuite/E202not.py b/testsuite/E202not.py deleted file mode 100644 index e152dcc..0000000 --- a/testsuite/E202not.py +++ /dev/null @@ -1,16 +0,0 @@ -spam(ham[1], {eggs: 2}) - -result = func( - arg1='some value', - arg2='another value', -) - -result = func( - arg1='some value', - arg2='another value' -) - -result = [ - item for item in items - if item > 5 -] diff --git a/testsuite/E203.py b/testsuite/E203.py deleted file mode 100644 index 7988201..0000000 --- a/testsuite/E203.py +++ /dev/null @@ -1 +0,0 @@ -if x == 4 : print x, y; x, y = y, x diff --git a/testsuite/E203b.py b/testsuite/E203b.py deleted file mode 100644 index 816c820..0000000 --- a/testsuite/E203b.py +++ /dev/null @@ -1 +0,0 @@ -if x == 4: print x, y ; x, y = y, x diff --git a/testsuite/E203c.py b/testsuite/E203c.py deleted file mode 100644 index aab0e18..0000000 --- a/testsuite/E203c.py +++ /dev/null @@ -1 +0,0 @@ -if x == 4: print x, y; x, y = y , x diff --git a/testsuite/E203not.py b/testsuite/E203not.py deleted file mode 100644 index 517aa8f..0000000 --- a/testsuite/E203not.py +++ /dev/null @@ -1,3 +0,0 @@ -if x == 4: print x, y; x, y = y, x -a[b1, :] == a[b1, ...] -b = a[:, b1] diff --git a/testsuite/E21.py b/testsuite/E21.py new file mode 100644 index 0000000..2280caf --- /dev/null +++ b/testsuite/E21.py @@ -0,0 +1,17 @@ +#: E211 +spam (1) +#: E211 +dict ['key'] = list [index] +#: E211 +dict['key'] ['subkey'] = list[index] +#: E225 +def squares(n): + return (i**2 for i in range(n)) +#: Okay +spam(1) +dict['key'] = list[index] + + +# This is not prohibited by PEP8, but avoid it. +class Foo (Bar, Baz): + pass diff --git a/testsuite/E211.py b/testsuite/E211.py deleted file mode 100644 index 0318639..0000000 --- a/testsuite/E211.py +++ /dev/null @@ -1 +0,0 @@ -spam (1) diff --git a/testsuite/E211b.py b/testsuite/E211b.py deleted file mode 100644 index d4d1a2d..0000000 --- a/testsuite/E211b.py +++ /dev/null @@ -1 +0,0 @@ -dict ['key'] = list [index] diff --git a/testsuite/E211c.py b/testsuite/E211c.py deleted file mode 100644 index ffb7f7e..0000000 --- a/testsuite/E211c.py +++ /dev/null @@ -1 +0,0 @@ -dict['key'] ['subkey'] = list[index] diff --git a/testsuite/E211not.py b/testsuite/E211not.py deleted file mode 100644 index ae6bcfb..0000000 --- a/testsuite/E211not.py +++ /dev/null @@ -1,12 +0,0 @@ -spam(1) -dict['key'] = list[index] - - -def squares(n): - return (i**2 for i in range(n)) - - -# This is not prohibited by PEP8, but avoid it. -class Foo (Bar, Baz): - pass - diff --git a/testsuite/E22.py b/testsuite/E22.py new file mode 100644 index 0000000..e0cb8f9 --- /dev/null +++ b/testsuite/E22.py @@ -0,0 +1,87 @@ +#: E221 +a = 12 + 3 +b = 4 + 5 +#: E221 +x = 1 +y = 2 +long_variable = 3 +#: E221 +x[0] = 1 +x[1] = 2 +long_variable = 3 +#: E221 +x = f(x) + 1 +y = long_variable + 2 +z = x[0] + 3 +#: Okay +x = 1 +y = 2 +long_variable = 3 +#: + + +#: E222 +a = a + 1 +b = b + 10 +#: E222 +x = -1 +y = -2 +long_variable = 3 +#: E222 +x[0] = 1 +x[1] = 2 +long_variable = 3 +#: + + +#: E223 +foobart = 4 +a = 3 # aligned with tab +#: + + +#: E224 +a += 1 +b += 1000 +#: + + +#: E225 +i=i+1 +#: E225 +submitted +=1 +#: E225 +x = x*2 - 1 +#: E225 +hypot2 = x*x + y*y +#: E225 +c = (a+b) * (a-b) +#: E225 +c =-1 +#: E225 +c = alpha -4 +#: E225 +z = (x + 1) **y +#: E225 +norman = True+False +#: E225 +_1MB = 2 ** 20 +_1kB = _1MB >>10 +#: +#: Okay +i = i + 1 +submitted += 1 +x = x * 2 - 1 +hypot2 = x * x + y * y +c = (a + b) * (a - b) +foo(bar, key='word', *args, **kwargs) +baz(**kwargs) +negative = -1 +spam(-1) +-negative +lambda *args, **kw: (args, kw) +lambda a, b=h[:], c=0: (a, b, c) +if not -5 < x < +5: + print >>sys.stderr, "x is out of range." +print >> sys.stdout, "x is an integer." +#: diff --git a/testsuite/E221.py b/testsuite/E221.py deleted file mode 100644 index 0cb8a7e..0000000 --- a/testsuite/E221.py +++ /dev/null @@ -1,2 +0,0 @@ -a = 12 + 3 -b = 4 + 5 diff --git a/testsuite/E221b.py b/testsuite/E221b.py deleted file mode 100644 index ea240e2..0000000 --- a/testsuite/E221b.py +++ /dev/null @@ -1,3 +0,0 @@ -x = 1 -y = 2 -long_variable = 3 diff --git a/testsuite/E221c.py b/testsuite/E221c.py deleted file mode 100644 index 38e9da2..0000000 --- a/testsuite/E221c.py +++ /dev/null @@ -1,3 +0,0 @@ -x[0] = 1 -x[1] = 2 -long_variable = 3 diff --git a/testsuite/E221d.py b/testsuite/E221d.py deleted file mode 100644 index 2653835..0000000 --- a/testsuite/E221d.py +++ /dev/null @@ -1,3 +0,0 @@ -x = f(x) + 1 -y = long_variable + 2 -z = x[0] + 3 diff --git a/testsuite/E221not.py b/testsuite/E221not.py deleted file mode 100644 index 5d6d567..0000000 --- a/testsuite/E221not.py +++ /dev/null @@ -1,3 +0,0 @@ -x = 1 -y = 2 -long_variable = 3 diff --git a/testsuite/E222.py b/testsuite/E222.py deleted file mode 100644 index 0173196..0000000 --- a/testsuite/E222.py +++ /dev/null @@ -1,2 +0,0 @@ -a = a + 1 -b = b + 10 diff --git a/testsuite/E222b.py b/testsuite/E222b.py deleted file mode 100644 index 58ccbf3..0000000 --- a/testsuite/E222b.py +++ /dev/null @@ -1,3 +0,0 @@ -x = -1 -y = -2 -long_variable = 3 diff --git a/testsuite/E222c.py b/testsuite/E222c.py deleted file mode 100644 index 8e914ea..0000000 --- a/testsuite/E222c.py +++ /dev/null @@ -1,3 +0,0 @@ -x[0] = 1 -x[1] = 2 -long_variable = 3 diff --git a/testsuite/E223.py b/testsuite/E223.py deleted file mode 100644 index 6ef7456..0000000 --- a/testsuite/E223.py +++ /dev/null @@ -1,2 +0,0 @@ -foobart = 4 -a = 3 # aligned with tab diff --git a/testsuite/E224.py b/testsuite/E224.py deleted file mode 100644 index d8ada7f..0000000 --- a/testsuite/E224.py +++ /dev/null @@ -1,2 +0,0 @@ -a += 1 -b += 1000 diff --git a/testsuite/E225.py b/testsuite/E225.py deleted file mode 100644 index f3dbc45..0000000 --- a/testsuite/E225.py +++ /dev/null @@ -1 +0,0 @@ -i=i+1 diff --git a/testsuite/E225a.py b/testsuite/E225a.py deleted file mode 100644 index 3681ad2..0000000 --- a/testsuite/E225a.py +++ /dev/null @@ -1 +0,0 @@ -submitted +=1 diff --git a/testsuite/E225b.py b/testsuite/E225b.py deleted file mode 100644 index b6e0b52..0000000 --- a/testsuite/E225b.py +++ /dev/null @@ -1 +0,0 @@ -x = x*2 - 1 diff --git a/testsuite/E225c.py b/testsuite/E225c.py deleted file mode 100644 index 44e6f63..0000000 --- a/testsuite/E225c.py +++ /dev/null @@ -1 +0,0 @@ -hypot2 = x*x + y*y diff --git a/testsuite/E225d.py b/testsuite/E225d.py deleted file mode 100644 index 54da1a5..0000000 --- a/testsuite/E225d.py +++ /dev/null @@ -1 +0,0 @@ -c = (a+b) * (a-b) diff --git a/testsuite/E225e.py b/testsuite/E225e.py deleted file mode 100644 index f6a3686..0000000 --- a/testsuite/E225e.py +++ /dev/null @@ -1 +0,0 @@ -c =-1 diff --git a/testsuite/E225f.py b/testsuite/E225f.py deleted file mode 100644 index 439aa97..0000000 --- a/testsuite/E225f.py +++ /dev/null @@ -1 +0,0 @@ -c = alpha -4 diff --git a/testsuite/E225g.py b/testsuite/E225g.py deleted file mode 100644 index 55198f3..0000000 --- a/testsuite/E225g.py +++ /dev/null @@ -1 +0,0 @@ -z = (x + 1) **y diff --git a/testsuite/E225h.py b/testsuite/E225h.py deleted file mode 100644 index c30deb6..0000000 --- a/testsuite/E225h.py +++ /dev/null @@ -1 +0,0 @@ -norman = True+False diff --git a/testsuite/E225i.py b/testsuite/E225i.py deleted file mode 100644 index 6f51eb9..0000000 --- a/testsuite/E225i.py +++ /dev/null @@ -1,2 +0,0 @@ -_1MB = 2 ** 20 -_1kB = _1MB >>10 diff --git a/testsuite/E225not.py b/testsuite/E225not.py deleted file mode 100644 index 918ee8d..0000000 --- a/testsuite/E225not.py +++ /dev/null @@ -1,15 +0,0 @@ -i = i + 1 -submitted += 1 -x = x * 2 - 1 -hypot2 = x * x + y * y -c = (a + b) * (a - b) -foo(bar, key='word', *args, **kwargs) -baz(**kwargs) -negative = -1 -spam(-1) --negative -lambda *args, **kw: (args, kw) -lambda a, b=h[:], c=0: (a, b, c) -if not -5 < x < +5: - print >>sys.stderr, "x is out of range." -print >> sys.stdout, "x is an integer." diff --git a/testsuite/E23.py b/testsuite/E23.py new file mode 100644 index 0000000..0f44f0c --- /dev/null +++ b/testsuite/E23.py @@ -0,0 +1,12 @@ +#: E231 +a = (1,2) +#: E231 +a[b1,:] +#: Okay +a = (4,) +b = (5, ) + +result = { + 'key1': 'value', + 'key2': 'value', +} diff --git a/testsuite/E231.py b/testsuite/E231.py deleted file mode 100644 index 98b0a3d..0000000 --- a/testsuite/E231.py +++ /dev/null @@ -1 +0,0 @@ -a = (1,2) diff --git a/testsuite/E231b.py b/testsuite/E231b.py deleted file mode 100644 index f6da77c..0000000 --- a/testsuite/E231b.py +++ /dev/null @@ -1 +0,0 @@ -a[b1,:] diff --git a/testsuite/E231not.py b/testsuite/E231not.py deleted file mode 100644 index 0d510bb..0000000 --- a/testsuite/E231not.py +++ /dev/null @@ -1,8 +0,0 @@ -a = (4,) -b = (5, ) - -result = { - 'key1': 'value', - 'key2': 'value', -} - diff --git a/testsuite/E24.py b/testsuite/E24.py new file mode 100644 index 0000000..92ca515 --- /dev/null +++ b/testsuite/E24.py @@ -0,0 +1,6 @@ +#: E241 +a = (1, 2) +b = (1, 20) +#: E242 +a = (1, 2) # tab before 2 +b = (1, 20) # space before 20 diff --git a/testsuite/E241.py b/testsuite/E241.py deleted file mode 100644 index 21ec72f..0000000 --- a/testsuite/E241.py +++ /dev/null @@ -1,2 +0,0 @@ -a = (1, 2) -b = (1, 20) diff --git a/testsuite/E242.py b/testsuite/E242.py deleted file mode 100644 index 40baaec..0000000 --- a/testsuite/E242.py +++ /dev/null @@ -1,2 +0,0 @@ -a = (1, 2) # tab before 2 -b = (1, 20) # space before 20 diff --git a/testsuite/E25.py b/testsuite/E25.py new file mode 100644 index 0000000..ea9d638 --- /dev/null +++ b/testsuite/E25.py @@ -0,0 +1,15 @@ +#: E251 +def foo(bar = False): + '''Test function with an error in declaration''' + pass +#: E251 +foo(bar= True) +#: E251 +foo(bar =True) +#: E251 +foo(bar = True) +#: Okay +foo(bar=(1 == 1)) +foo(bar=(1 != 1)) +foo(bar=(1 >= 1)) +foo(bar=(1 <= 1)) diff --git a/testsuite/E251.py b/testsuite/E251.py deleted file mode 100644 index e7c1843..0000000 --- a/testsuite/E251.py +++ /dev/null @@ -1,3 +0,0 @@ -def foo(bar = False): - '''Test function with an error in declaration''' - pass diff --git a/testsuite/E251b.py b/testsuite/E251b.py deleted file mode 100644 index 0d424b4..0000000 --- a/testsuite/E251b.py +++ /dev/null @@ -1 +0,0 @@ -foo(bar= True) diff --git a/testsuite/E251c.py b/testsuite/E251c.py deleted file mode 100644 index eb81c22..0000000 --- a/testsuite/E251c.py +++ /dev/null @@ -1 +0,0 @@ -foo(bar =True) diff --git a/testsuite/E251d.py b/testsuite/E251d.py deleted file mode 100644 index 90d8668..0000000 --- a/testsuite/E251d.py +++ /dev/null @@ -1 +0,0 @@ -foo(bar = True) diff --git a/testsuite/E251not.py b/testsuite/E251not.py deleted file mode 100644 index 0e4213c..0000000 --- a/testsuite/E251not.py +++ /dev/null @@ -1,5 +0,0 @@ -# These are not errors -foo(bar=(1 == 1)) -foo(bar=(1 != 1)) -foo(bar=(1 >= 1)) -foo(bar=(1 <= 1)) diff --git a/testsuite/E26.py b/testsuite/E26.py new file mode 100644 index 0000000..b4f7af7 --- /dev/null +++ b/testsuite/E26.py @@ -0,0 +1,6 @@ +#: E261 +pass # an inline comment +#: E262 +x = x + 1 #Increment x +#: E262 +x = x + 1 # Increment x diff --git a/testsuite/E261.py b/testsuite/E261.py deleted file mode 100644 index 4d87729..0000000 --- a/testsuite/E261.py +++ /dev/null @@ -1 +0,0 @@ -pass # an inline comment diff --git a/testsuite/E262.py b/testsuite/E262.py deleted file mode 100644 index 7402e10..0000000 --- a/testsuite/E262.py +++ /dev/null @@ -1 +0,0 @@ -x = x + 1 #Increment x diff --git a/testsuite/E262b.py b/testsuite/E262b.py deleted file mode 100644 index b7ecc32..0000000 --- a/testsuite/E262b.py +++ /dev/null @@ -1 +0,0 @@ -x = x + 1 # Increment x diff --git a/testsuite/E30.py b/testsuite/E30.py new file mode 100644 index 0000000..e2d6271 --- /dev/null +++ b/testsuite/E30.py @@ -0,0 +1,66 @@ +#: E301 +class X: + + def a(): + pass + def b(): + pass +#: E301 +class X: + + def a(): + pass + # comment + def b(): + pass +#: + + +#: E302 +def a(): + pass + +def b(): + pass +#: E302 +def a(): + pass + +# comment + +def b(): + pass +#: + + +#: E303 +print + + + +print +#: E303 +print + + + +# comment + +print +#: E303 +def a(): + print + + + # comment + + print +#: + + +#: E304 +@decorator + +def function(): + pass +#: diff --git a/testsuite/E301.py b/testsuite/E301.py deleted file mode 100644 index f77fabe..0000000 --- a/testsuite/E301.py +++ /dev/null @@ -1,6 +0,0 @@ -class X: - - def a(): - pass - def b(): - pass diff --git a/testsuite/E301b.py b/testsuite/E301b.py deleted file mode 100644 index fee3301..0000000 --- a/testsuite/E301b.py +++ /dev/null @@ -1,7 +0,0 @@ -class X: - - def a(): - pass - # comment - def b(): - pass diff --git a/testsuite/E301not.py b/testsuite/E301not.py deleted file mode 100644 index da32dd3..0000000 --- a/testsuite/E301not.py +++ /dev/null @@ -1,59 +0,0 @@ -class X: - - def a(): - pass - - # comment - def b(): - pass - - # This is a - # ... multi-line comment - - def c(): - pass - - -# This is a -# ... multi-line comment - -@some_decorator -class Y: - - def a(): - pass - - # comment - - def b(): - pass - - @property - def c(): - pass - - -try: - from nonexistent import Bar -except ImportError: - class Bar(object): - """This is a Bar replacement""" - - -def with_feature(f): - """Some decorator""" - wrapper = f - if has_this_feature(f): - def wrapper(*args): - call_feature(args[0]) - return f(*args) - return wrapper - - -try: - next -except NameError: - def next(iterator, default): - for item in iterator: - return item - return default diff --git a/testsuite/E302.py b/testsuite/E302.py deleted file mode 100644 index ccf4703..0000000 --- a/testsuite/E302.py +++ /dev/null @@ -1,5 +0,0 @@ -def a(): - pass - -def b(): - pass diff --git a/testsuite/E302b.py b/testsuite/E302b.py deleted file mode 100644 index f468dde..0000000 --- a/testsuite/E302b.py +++ /dev/null @@ -1,7 +0,0 @@ -def a(): - pass - -# comment - -def b(): - pass diff --git a/testsuite/E302not.py b/testsuite/E302not.py deleted file mode 100644 index 548d551..0000000 --- a/testsuite/E302not.py +++ /dev/null @@ -1,36 +0,0 @@ -def a(): - pass - - -class Foo(): - """Class Foo""" - - def b(): - - pass - - -# comment -def c(): - pass - - -# comment - - -def d(): - pass - -# This is a -# ... multi-line comment - -# And this one is -# ... a second paragraph -# ... which spans on 3 lines - - -# Function `e` is below -# NOTE: Hey this is a testcase - -def e(): - pass diff --git a/testsuite/E303.py b/testsuite/E303.py deleted file mode 100644 index 99e8ce2..0000000 --- a/testsuite/E303.py +++ /dev/null @@ -1,5 +0,0 @@ -print - - - -print diff --git a/testsuite/E303b.py b/testsuite/E303b.py deleted file mode 100644 index 3b24e3e..0000000 --- a/testsuite/E303b.py +++ /dev/null @@ -1,7 +0,0 @@ -print - - - -# comment - -print diff --git a/testsuite/E303c.py b/testsuite/E303c.py deleted file mode 100644 index 7b9754c..0000000 --- a/testsuite/E303c.py +++ /dev/null @@ -1,7 +0,0 @@ -def a(): - print - - - # comment - - print diff --git a/testsuite/E303not.py b/testsuite/E303not.py deleted file mode 100644 index 7387dbd..0000000 --- a/testsuite/E303not.py +++ /dev/null @@ -1,19 +0,0 @@ -def a(): - print - - # comment - - print - - print - -# Comment 1 - -# Comment 2 - - -# Comment 3 - -def b(): - - pass diff --git a/testsuite/E304.py b/testsuite/E304.py deleted file mode 100644 index 5edba99..0000000 --- a/testsuite/E304.py +++ /dev/null @@ -1,4 +0,0 @@ -@decorator - -def function(): - pass diff --git a/testsuite/E30not.py b/testsuite/E30not.py new file mode 100644 index 0000000..8538fd7 --- /dev/null +++ b/testsuite/E30not.py @@ -0,0 +1,118 @@ +class X: + + def a(): + pass + + # comment + def b(): + pass + + # This is a + # ... multi-line comment + + def c(): + pass + + +# This is a +# ... multi-line comment + +@some_decorator +class Y: + + def a(): + pass + + # comment + + def b(): + pass + + @property + def c(): + pass + + +try: + from nonexistent import Bar +except ImportError: + class Bar(object): + """This is a Bar replacement""" + + +def with_feature(f): + """Some decorator""" + wrapper = f + if has_this_feature(f): + def wrapper(*args): + call_feature(args[0]) + return f(*args) + return wrapper + + +try: + next +except NameError: + def next(iterator, default): + for item in iterator: + return item + return default + + +def a(): + pass + + +class Foo(): + """Class Foo""" + + def b(): + + pass + + +# comment +def c(): + pass + + +# comment + + +def d(): + pass + +# This is a +# ... multi-line comment + +# And this one is +# ... a second paragraph +# ... which spans on 3 lines + + +# Function `e` is below +# NOTE: Hey this is a testcase + +def e(): + pass + + +def a(): + print + + # comment + + print + + print + +# Comment 1 + +# Comment 2 + + +# Comment 3 + +def b(): + + pass diff --git a/testsuite/E40.py b/testsuite/E40.py new file mode 100644 index 0000000..d921c25 --- /dev/null +++ b/testsuite/E40.py @@ -0,0 +1,13 @@ +#: E401 +import os, sys +#: Okay +import os +import sys + +from subprocess import Popen, PIPE + +from myclass import MyClass +from foo.bar.yourclass import YourClass + +import myclass +import foo.bar.yourclass diff --git a/testsuite/E401.py b/testsuite/E401.py deleted file mode 100644 index e652432..0000000 --- a/testsuite/E401.py +++ /dev/null @@ -1 +0,0 @@ -import os, sys diff --git a/testsuite/E401not.py b/testsuite/E401not.py deleted file mode 100644 index 856c1b1..0000000 --- a/testsuite/E401not.py +++ /dev/null @@ -1,10 +0,0 @@ -import os -import sys - -from subprocess import Popen, PIPE - -from myclass import MyClass -from foo.bar.yourclass import YourClass - -import myclass -import foo.bar.yourclass diff --git a/testsuite/E50.py b/testsuite/E50.py new file mode 100644 index 0000000..1c26e4f --- /dev/null +++ b/testsuite/E50.py @@ -0,0 +1,2 @@ +#: E501 +a = '12345678901234567890123456789012345678901234567890123456789012345678901234567890' diff --git a/testsuite/E501.py b/testsuite/E501.py deleted file mode 100644 index 4cdc757..0000000 --- a/testsuite/E501.py +++ /dev/null @@ -1 +0,0 @@ -a = '12345678901234567890123456789012345678901234567890123456789012345678901234567890' diff --git a/testsuite/E501not.py b/testsuite/E501not.py deleted file mode 100644 index 46bdb2d..0000000 --- a/testsuite/E501not.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - - -class Rectangle(Blob): - - def __init__(self, width, height, - color='black', emphasis=None, highlight=0): - if width == 0 and height == 0 and \ - color == 'red' and emphasis == 'strong' or \ - highlight > 100: - raise ValueError("sorry, you lose") - if width == 0 and height == 0 and (color == 'red' or - emphasis is None): - raise ValueError("I don't think so -- values are %s, %s" % - (width, height)) - Blob.__init__(self, width, height, - color, emphasis, highlight) - - -# Some random text with multi-byte characters (utf-8 encoded) -# -# Εδώ μάτσο κειμένων τη, τρόπο πιθανό διευθυντές ώρα μη. Νέων απλό παράγει ροή -# κι, το επί δεδομένη καθορίζουν. Πάντως ζητήσεις περιβάλλοντος ένα με, τη -# ξέχασε αρπάζεις φαινόμενο όλη. Τρέξει εσφαλμένη χρησιμοποίησέ νέα τι. Θα όρο -# πετάνε φακέλους, άρα με διακοπής λαμβάνουν εφαμοργής. Λες κι μειώσει -# καθυστερεί. diff --git a/testsuite/E70.py b/testsuite/E70.py new file mode 100644 index 0000000..e0a9a7d --- /dev/null +++ b/testsuite/E70.py @@ -0,0 +1,4 @@ +#: E701 +if a: a = False +#: E702 +a = False; b = True diff --git a/testsuite/E701.py b/testsuite/E701.py deleted file mode 100644 index 77273e7..0000000 --- a/testsuite/E701.py +++ /dev/null @@ -1 +0,0 @@ -if a: a = False diff --git a/testsuite/E702.py b/testsuite/E702.py deleted file mode 100644 index 9cb8415..0000000 --- a/testsuite/E702.py +++ /dev/null @@ -1 +0,0 @@ -a = False; b = True diff --git a/testsuite/W19.py b/testsuite/W19.py new file mode 100644 index 0000000..a629abe --- /dev/null +++ b/testsuite/W19.py @@ -0,0 +1,3 @@ +#: W191 +if False: + print # indented with 1 tab diff --git a/testsuite/W191.py b/testsuite/W191.py deleted file mode 100644 index 81cca0b..0000000 --- a/testsuite/W191.py +++ /dev/null @@ -1,2 +0,0 @@ -if False: - print # indented with 1 tab diff --git a/testsuite/W29.py b/testsuite/W29.py new file mode 100644 index 0000000..85f1137 --- /dev/null +++ b/testsuite/W29.py @@ -0,0 +1,8 @@ +#: W291 +print +#: W293 +class Foo(object): + + bang = 12 +#: W292 +# This line doesn't have a linefeed \ No newline at end of file diff --git a/testsuite/W291.py b/testsuite/W291.py deleted file mode 100644 index 004cfa9..0000000 --- a/testsuite/W291.py +++ /dev/null @@ -1 +0,0 @@ -print diff --git a/testsuite/W291not.py b/testsuite/W291not.py deleted file mode 100644 index 10fd47a..0000000 --- a/testsuite/W291not.py +++ /dev/null @@ -1,3 +0,0 @@ -class Foo(object): - - bang = 12 diff --git a/testsuite/W292.py b/testsuite/W292.py deleted file mode 100644 index bf3205e..0000000 --- a/testsuite/W292.py +++ /dev/null @@ -1 +0,0 @@ -# This line doesn't have a linefeed \ No newline at end of file diff --git a/testsuite/W293.py b/testsuite/W293.py deleted file mode 100644 index 10fd47a..0000000 --- a/testsuite/W293.py +++ /dev/null @@ -1,3 +0,0 @@ -class Foo(object): - - bang = 12 diff --git a/testsuite/W39.py b/testsuite/W39.py new file mode 100644 index 0000000..4fe4fc4 --- /dev/null +++ b/testsuite/W39.py @@ -0,0 +1,3 @@ +#: W391 +# The next line is blank + diff --git a/testsuite/W391.py b/testsuite/W391.py deleted file mode 100644 index 0975d3a..0000000 --- a/testsuite/W391.py +++ /dev/null @@ -1,2 +0,0 @@ -# The next line is blank - diff --git a/testsuite/W60.py b/testsuite/W60.py new file mode 100644 index 0000000..19b6549 --- /dev/null +++ b/testsuite/W60.py @@ -0,0 +1,10 @@ +#: W601 +if a.has_key("b"): + print a +#: W602 +raise DummyError, "Message" +#: W603 +if x <> 0: + x = 0 +#: W604 +val = `1 + 2` diff --git a/testsuite/W601.py b/testsuite/W601.py deleted file mode 100644 index 466ba63..0000000 --- a/testsuite/W601.py +++ /dev/null @@ -1,2 +0,0 @@ -if a.has_key("b"): - print a diff --git a/testsuite/W602.py b/testsuite/W602.py deleted file mode 100644 index d64883d..0000000 --- a/testsuite/W602.py +++ /dev/null @@ -1 +0,0 @@ -raise DummyError, "Message" diff --git a/testsuite/W603.py b/testsuite/W603.py deleted file mode 100644 index 5dd9b7d..0000000 --- a/testsuite/W603.py +++ /dev/null @@ -1,2 +0,0 @@ -if x <> 0: - x = 0 diff --git a/testsuite/W604.py b/testsuite/W604.py deleted file mode 100644 index bfe92b9..0000000 --- a/testsuite/W604.py +++ /dev/null @@ -1 +0,0 @@ -val = `1 + 2` diff --git a/testsuite/latin-1.py b/testsuite/latin-1.py new file mode 100644 index 0000000..8328cfb --- /dev/null +++ b/testsuite/latin-1.py @@ -0,0 +1,6 @@ +# -*- coding: latin-1 -*- +# Test non-UTF8 encoding +latin1 = ('' + '') + +c = ("w") diff --git a/testsuite/utf-8.py b/testsuite/utf-8.py new file mode 100644 index 0000000..46bdb2d --- /dev/null +++ b/testsuite/utf-8.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + + +class Rectangle(Blob): + + def __init__(self, width, height, + color='black', emphasis=None, highlight=0): + if width == 0 and height == 0 and \ + color == 'red' and emphasis == 'strong' or \ + highlight > 100: + raise ValueError("sorry, you lose") + if width == 0 and height == 0 and (color == 'red' or + emphasis is None): + raise ValueError("I don't think so -- values are %s, %s" % + (width, height)) + Blob.__init__(self, width, height, + color, emphasis, highlight) + + +# Some random text with multi-byte characters (utf-8 encoded) +# +# Εδώ μάτσο κειμένων τη, τρόπο πιθανό διευθυντές ώρα μη. Νέων απλό παράγει ροή +# κι, το επί δεδομένη καθορίζουν. Πάντως ζητήσεις περιβάλλοντος ένα με, τη +# ξέχασε αρπάζεις φαινόμενο όλη. Τρέξει εσφαλμένη χρησιμοποίησέ νέα τι. Θα όρο +# πετάνε φακέλους, άρα με διακοπής λαμβάνουν εφαμοργής. Λες κι μειώσει +# καθυστερεί. -- cgit v1.2.1