Ignore:
Timestamp:
12/29/08 12:24:05 (6 years ago)
Author:
xi
Message:

Added basic support for Python 3 (Thanks idadesub(at)users(dot)sourceforge(dot)net).

Location:
pyyaml/trunk/tests3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/tests3/test_reader.py

    r322 r328  
    11 
    22import yaml.reader 
    3 import codecs 
    43 
    54def _run_reader(data, verbose): 
    65    try: 
    76        stream = yaml.reader.Reader(data) 
    8         while stream.peek() != u'\0': 
     7        while stream.peek() != '\0': 
    98            stream.forward() 
    10     except yaml.reader.ReaderError, exc: 
     9    except yaml.reader.ReaderError as exc: 
    1110        if verbose: 
    12             print exc 
     11            print(exc) 
    1312    else: 
    1413        raise AssertionError("expected an exception") 
     
    1918    for encoding in ['utf-8', 'utf-16-le', 'utf-16-be']: 
    2019        try: 
    21             data = unicode(open(error_filename, 'rb').read(), encoding) 
     20            data = open(error_filename, 'rb').read().decode(encoding) 
    2221            break 
    2322        except UnicodeDecodeError: 
     
    2625        return 
    2726    _run_reader(data, verbose) 
    28     _run_reader(codecs.open(error_filename, encoding=encoding), verbose) 
     27    _run_reader(open(error_filename, encoding=encoding), verbose) 
    2928 
    3029test_stream_error.unittest = ['.stream-error'] 
Note: See TracChangeset for help on using the changeset viewer.