Permalink
Browse files

Tweak doctests so they survive 2to3 better

  • Loading branch information...
1 parent ec631c0 commit a4635065da6c665fd84c5e111f81fb722135ba0f @daviddrysdale committed Nov 11, 2011
Showing with 26 additions and 26 deletions.
  1. +6 −6 python/phonenumbers/__init__.py
  2. +20 −20 python/phonenumbers/geocoder.py
@@ -8,12 +8,12 @@
Country Code: 44 National Number: 2083661177 Leading Zero: False
>>> type(x)
<class 'phonenumbers.phonenumber.PhoneNumber'>
->>> phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.NATIONAL)
-u'020 8366 1177'
->>> phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.INTERNATIONAL)
-u'+44 20 8366 1177'
->>> phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.E164)
-u'+442083661177'
+>>> str(phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.NATIONAL))
+'020 8366 1177'
+>>> str(phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.INTERNATIONAL))
+'+44 20 8366 1177'
+>>> str(phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.E164))
+'+442083661177'
>>> y = phonenumbers.parse("020 8366 1177", "GB")
>>> print y
Country Code: 44 National Number: 2083661177 Leading Zero: False
@@ -5,26 +5,26 @@
>>> gb_number = phonenumbers.parse("+442083612345", "GB")
>>> de_number = phonenumbers.parse("0891234567", "DE")
>>> ch_number = phonenumbers.parse("0431234567", "CH")
->>> print repr(area_description_for_number(gb_number, "en"))
-u'London'
->>> print repr(area_description_for_number(gb_number, "fr")) # fall back to English
-u'London'
->>> print repr(area_description_for_number(gb_number, "en", region="GB"))
-u'London'
->>> print repr(area_description_for_number(gb_number, "en", region="US"))
-u'London'
->>> print repr(area_description_for_number(de_number, "en"))
-u'Munich'
->>> print repr(area_description_for_number(de_number, "de"))
-u'M\\xfcnchen'
->>> print repr(area_description_for_number(ch_number, "de"))
-u'Z\\xfcrich'
->>> print repr(area_description_for_number(ch_number, "en"))
-u'Zurich'
->>> print repr(area_description_for_number(ch_number, "fr"))
-u'Zurich'
->>> print repr(area_description_for_number(ch_number, "it"))
-u'Zurigo'
+>>> str(area_description_for_number(gb_number, "en"))
+'London'
+>>> str(area_description_for_number(gb_number, "fr")) # fall back to English
+'London'
+>>> str(area_description_for_number(gb_number, "en", region="GB"))
+'London'
+>>> str(area_description_for_number(gb_number, "en", region="US"))
+'London'
+>>> str(area_description_for_number(de_number, "en"))
+'Munich'
+>>> u'M\xfcnchen' == area_description_for_number(de_number, "de")
+True
+>>> u'Z\xfcrich' == area_description_for_number(ch_number, "de")
+True
+>>> str(area_description_for_number(ch_number, "en"))
+'Zurich'
+>>> str(area_description_for_number(ch_number, "fr"))
+'Zurich'
+>>> str(area_description_for_number(ch_number, "it"))
+'Zurigo'
"""
# Based very loosely on original Java code:

0 comments on commit a463506

Please sign in to comment.