mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
RSS: Fix tests for Python 3.
This commit is contained in:
parent
332164aa20
commit
db50e65b86
@ -33,9 +33,9 @@ import feedparser
|
||||
from supybot.test import *
|
||||
import supybot.conf as conf
|
||||
if sys.version_info[0] >= 3:
|
||||
from io import StringIO
|
||||
from io import BytesIO
|
||||
else:
|
||||
from cStringIO import StringIO
|
||||
from cStringIO import StringIO as BytesIO
|
||||
|
||||
xkcd_old = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss version="2.0"><channel><title>xkcd.com</title><link>http://xkcd.com/</link><description>xkcd.com: A webcomic of romance and math humor.</description><language>en</language><item><title>Snake Facts</title><link>http://xkcd.com/1398/</link><description><img src="http://imgs.xkcd.com/comics/snake_facts.png" title="Biologically speaking, what we call a 'snake' is actually a human digestive tract which has escaped from its host." alt="Biologically speaking, what we call a 'snake' is actually a human digestive tract which has escaped from its host." /></description><pubDate>Wed, 23 Jul 2014 04:00:00 -0000</pubDate><guid>http://xkcd.com/1398/</guid></item></channel></rss>
|
||||
@ -45,9 +45,12 @@ xkcd_new = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss version="2.0"><channel><title>xkcd.com</title><link>http://xkcd.com/</link><description>xkcd.com: A webcomic of romance and math humor.</description><language>en</language><item><title>Chaos</title><link>http://xkcd.com/1399/</link><description><img src="http://imgs.xkcd.com/comics/chaos.png" title="Although the oral exam for the doctorate was just 'can you do that weird laugh?'" alt="Although the oral exam for the doctorate was just 'can you do that weird laugh?'" /></description><pubDate>Fri, 25 Jul 2014 04:00:00 -0000</pubDate><guid>http://xkcd.com/1399/</guid></item><item><title>Snake Facts</title><link>http://xkcd.com/1398/</link><description><img src="http://imgs.xkcd.com/comics/snake_facts.png" title="Biologically speaking, what we call a 'snake' is actually a human digestive tract which has escaped from its host." alt="Biologically speaking, what we call a 'snake' is actually a human digestive tract which has escaped from its host." /></description><pubDate>Wed, 23 Jul 2014 04:00:00 -0000</pubDate><guid>http://xkcd.com/1398/</guid></item></channel></rss>
|
||||
"""
|
||||
|
||||
|
||||
def constant(content):
|
||||
if sys.version_info[0] >= 3:
|
||||
content = content.encode()
|
||||
def f(*args, **kwargs):
|
||||
return StringIO(content)
|
||||
return BytesIO(content)
|
||||
return f
|
||||
|
||||
url = 'http://www.advogato.org/rss/articles.xml'
|
||||
|
Loading…
Reference in New Issue
Block a user