diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-04-24 14:16:15 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-04-24 14:16:15 -0700 |
commit | 943a48fc5c0a59b892eb746073c71b8dd88815e7 (patch) | |
tree | 421cfedbc60603d02e0b314d9204e9f85dd781c5 /demoscript/Freeze/library.py | |
parent | minor fix to IcePHP getLogger (diff) | |
download | ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.tar.bz2 ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.tar.xz ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.zip |
python 3 support
Diffstat (limited to 'demoscript/Freeze/library.py')
-rwxr-xr-x | demoscript/Freeze/library.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/demoscript/Freeze/library.py b/demoscript/Freeze/library.py index 9ed0fbf1357..38dc33075cb 100755 --- a/demoscript/Freeze/library.py +++ b/demoscript/Freeze/library.py @@ -9,7 +9,7 @@ # ********************************************************************** import sys -from scripts import Expect +import Expect def dequote(s): cur = 0 @@ -38,7 +38,7 @@ def mkregexp(s): return s def run(client, server): - print "populating database... ", + sys.stdout.write("populating database... ") sys.stdout.flush() f = open("books", "r") books = [] @@ -47,16 +47,16 @@ def run(client, server): client.expect('added new book') isbn, title, author = dequote(l) books.append((isbn, title, author)) - print "ok" + print("ok") byauthor = {} for b in books: isbn, title, author = b - if not byauthor.has_key(author): + if author not in byauthor: byauthor[author] = [] byauthor[author].append(b) - print "testing isbn... ", + sys.stdout.write("testing isbn... ") sys.stdout.flush() for b in books: isbn, title, author = b @@ -67,11 +67,11 @@ def run(client, server): client.expect('authors: %s' %(author)) client.sendline('isbn 1000') client.expect('no book with that') - print "ok" + print("ok") - print "testing authors... ", + sys.stdout.write("testing authors... ") sys.stdout.flush() - for a, bl in byauthor.iteritems(): + for a, bl in byauthor.items(): client.sendline('authors "%s"' %(a)) client.expect('number of books found: ([0-9]+)') n = int(client.match.group(1)) @@ -97,9 +97,9 @@ def run(client, server): client.sendline('authors foo') client.expect('number of books found: 0') client.expect('no current book') - print "ok" + print("ok") - print "testing rent/return... ", + sys.stdout.write("testing rent/return... ") sys.stdout.flush() isbn, title, author = books[0] client.sendline('isbn %s' % (isbn)) @@ -117,9 +117,9 @@ def run(client, server): client.expect('rented:', timeout=2) except Expect.TIMEOUT: pass - print "ok" + print("ok") - print "testing remove... ", + sys.stdout.write("testing remove... ") sys.stdout.flush() isbn, title, author = books[0] client.sendline('isbn %s' % (isbn)) @@ -135,4 +135,4 @@ def run(client, server): client.sendline('exit') client.waitTestSuccess() - print "ok" + print("ok") |