summaryrefslogtreecommitdiff
path: root/test_maidenhead.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2016-03-22 03:08:21 -0400
committerEric S. Raymond <esr@thyrsus.com>2016-03-22 03:08:21 -0400
commit8200880a4949fd112674551374868f292b8a6524 (patch)
tree5332fe0413615a729c4953d43cba7a7ea7a1a17f /test_maidenhead.py
parent254022f6c77e55280c6da59a01ee5225abdf7bcb (diff)
downloadgpsd-8200880a4949fd112674551374868f292b8a6524.tar.gz
Forward-port Python utilities to run polyglot under either Python 2 or 3.
For the moment most shebang lines still say 'python2' rather than just 'python'. This is because the client code in gps/ hasn't been touched yet; the internal imports break under Python 3 and that needs to be fixed.
Diffstat (limited to 'test_maidenhead.py')
-rwxr-xr-xtest_maidenhead.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/test_maidenhead.py b/test_maidenhead.py
index 5463d01b..e8d5459d 100755
--- a/test_maidenhead.py
+++ b/test_maidenhead.py
@@ -7,6 +7,8 @@
# Test conversions generated using
# http://f6fvy.free.fr/qthLocator/
+from __future__ import print_function
+
import sys, gps.clienthelpers
errors = 0
@@ -18,11 +20,11 @@ for (lat, lon, maidenhead, location) in [
]:
converted = gps.clienthelpers.maidenhead(lat, lon)
if converted != maidenhead:
- print >>sys.stderr, "maidenhead test: from %s %s (%s) expected %s got %s" \
- % (lat, lon, location, maidenhead, converted)
+ sys.stderr.write("maidenhead test: from %s %s (%s) expected %s got %s\n" \
+ % (lat, lon, location, maidenhead, converted))
errors += 1
else:
- print "%s OK" % location
+ print("%s OK" % location)
if errors:
sys.exit(1)