Ignore:
Timestamp:
12/29/08 12:24:05 (5 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_constructor.py

    r325 r328  
    44 
    55import datetime 
    6 try: 
    7     set 
    8 except NameError: 
    9     from sets import Set as set 
    106import yaml.tokens 
    117 
    128def execute(code): 
    13     exec code 
     9    exec(code) 
    1410    return value 
    1511 
     
    230226    elif isinstance(data, datetime.datetime): 
    231227        return repr(data.utctimetuple()) 
    232     elif isinstance(data, unicode): 
    233         return data.encode('utf-8') 
    234228    elif isinstance(data, float) and data != data: 
    235229        return '?' 
     
    252246            pass 
    253247        if verbose: 
    254             print "SERIALIZED NATIVE1:" 
    255             print _serialize_value(native1) 
    256             print "SERIALIZED NATIVE2:" 
    257             print _serialize_value(native2) 
     248            print("SERIALIZED NATIVE1:") 
     249            print(_serialize_value(native1)) 
     250            print("SERIALIZED NATIVE2:") 
     251            print(_serialize_value(native2)) 
    258252        assert _serialize_value(native1) == _serialize_value(native2), (native1, native2) 
    259253    finally: 
    260254        if verbose: 
    261             print "NATIVE1:" 
     255            print("NATIVE1:") 
    262256            pprint.pprint(native1) 
    263             print "NATIVE2:" 
     257            print("NATIVE2:") 
    264258            pprint.pprint(native2) 
    265259 
Note: See TracChangeset for help on using the changeset viewer.