From cfda3dd18c3643d33c4bccbea620a446470faae7 Mon Sep 17 00:00:00 2001 From: GLolol Date: Sat, 25 Oct 2014 21:45:08 -0700 Subject: [PATCH] TLDInfo: fix internationalized TLD tests and update output - This reverts commit f3dcd83 and part of commit 30f5e31 --- TLDInfo/plugin.py | 3 +-- TLDInfo/test.py | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/TLDInfo/plugin.py b/TLDInfo/plugin.py index 71ed5a9..011bc78 100644 --- a/TLDInfo/plugin.py +++ b/TLDInfo/plugin.py @@ -61,8 +61,7 @@ class TLDInfo(callbacks.Plugin): data = utils.web.getUrl(db + s) except utils.web.Error as e: if "HTTP Error 404:" in str(e): - irc.reply("No results found for TLD {} (using " - "http://www.iana.org/domains/root/db)".format("."+text)) + irc.error("No results found for TLD .{}".format(text), Raise=True) else: irc.error("An error occurred while contacting IANA's " "TLD Database.", Raise=True) diff --git a/TLDInfo/test.py b/TLDInfo/test.py index a1cc221..e088f92 100644 --- a/TLDInfo/test.py +++ b/TLDInfo/test.py @@ -28,6 +28,7 @@ ### +from sys import version_info from supybot.test import * class TLDInfoTestCase(PluginTestCase): @@ -40,8 +41,10 @@ class TLDInfoTestCase(PluginTestCase): # https://www.iana.org/domains/root/db/xn--io0a7i # Chinese internationalized domain for 'network' (similar to .net) self.assertNotError('tld xn--io0a7i') - # self.assertNotError('tld \u7f51\u7edc') - self.assertNotRegexp('tld xn--io0a7i', '.*no results found.*', re.I) - # self.assertNotRegexp('tld \u7f51\u7edc', '.*no results found.*', re.I) + if version_info[0] > 3: + self.assertNotError('tld \u7f51\u7edc') + else: + from codecs import unicode_escape_decode as u + self.assertNotError('tld '+u('\u7f51\u7edc')[0]) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: