mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-29 06:51:10 -05:00
TLDInfo: fix internationalized TLD tests and update output
- This reverts commit f3dcd83 and part of commit 30f5e31
This commit is contained in:
parent
c7f3110a60
commit
cfda3dd18c
@ -61,8 +61,7 @@ class TLDInfo(callbacks.Plugin):
|
|||||||
data = utils.web.getUrl(db + s)
|
data = utils.web.getUrl(db + s)
|
||||||
except utils.web.Error as e:
|
except utils.web.Error as e:
|
||||||
if "HTTP Error 404:" in str(e):
|
if "HTTP Error 404:" in str(e):
|
||||||
irc.reply("No results found for TLD {} (using "
|
irc.error("No results found for TLD .{}".format(text), Raise=True)
|
||||||
"http://www.iana.org/domains/root/db)".format("."+text))
|
|
||||||
else:
|
else:
|
||||||
irc.error("An error occurred while contacting IANA's "
|
irc.error("An error occurred while contacting IANA's "
|
||||||
"TLD Database.", Raise=True)
|
"TLD Database.", Raise=True)
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
from sys import version_info
|
||||||
from supybot.test import *
|
from supybot.test import *
|
||||||
|
|
||||||
class TLDInfoTestCase(PluginTestCase):
|
class TLDInfoTestCase(PluginTestCase):
|
||||||
@ -40,8 +41,10 @@ class TLDInfoTestCase(PluginTestCase):
|
|||||||
# https://www.iana.org/domains/root/db/xn--io0a7i
|
# https://www.iana.org/domains/root/db/xn--io0a7i
|
||||||
# Chinese internationalized domain for 'network' (similar to .net)
|
# Chinese internationalized domain for 'network' (similar to .net)
|
||||||
self.assertNotError('tld xn--io0a7i')
|
self.assertNotError('tld xn--io0a7i')
|
||||||
# self.assertNotError('tld \u7f51\u7edc')
|
if version_info[0] > 3:
|
||||||
self.assertNotRegexp('tld xn--io0a7i', '.*no results found.*', re.I)
|
self.assertNotError('tld \u7f51\u7edc')
|
||||||
# self.assertNotRegexp('tld \u7f51\u7edc', '.*no results found.*', re.I)
|
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:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user