@@ -15,29 +15,29 @@ class TestSequenceFunctions(unittest.TestCase):
1515
1616 def setUp (self ):
1717 fg = FeedGenerator ()
18- self .feedId = ' http://example.com'
19- self .title = ' Some Testfeed'
18+ self .feedId = " http://example.com"
19+ self .title = " Some Testfeed"
2020
2121 fg .id (self .feedId )
2222 fg .title (self .title )
23- fg .link (href = ' http://lkiesow.de' , rel = ' alternate' )[0 ]
24- fg .description (' ...' )
23+ fg .link (href = " http://lkiesow.de" , rel = " alternate" )[0 ]
24+ fg .description (" ..." )
2525
2626 fe = fg .add_entry ()
27- fe .id (' http://lernfunk.de/media/654321/1' )
28- fe .title (' The First Episode' )
29- fe .content (u'…' )
27+ fe .id (" http://lernfunk.de/media/654321/1" )
28+ fe .title (" The First Episode" )
29+ fe .content ("…" )
3030
3131 # Use also the different name add_item
3232 fe = fg .add_item ()
33- fe .id (' http://lernfunk.de/media/654321/1' )
34- fe .title (' The Second Episode' )
35- fe .content (u'…' )
33+ fe .id (" http://lernfunk.de/media/654321/1" )
34+ fe .title (" The Second Episode" )
35+ fe .content ("…" )
3636
3737 fe = fg .add_entry ()
38- fe .id (' http://lernfunk.de/media/654321/1' )
39- fe .title (' The Third Episode' )
40- fe .content (u'…' )
38+ fe .id (" http://lernfunk.de/media/654321/1" )
39+ fe .title (" The Third Episode" )
40+ fe .content ("…" )
4141
4242 self .fg = fg
4343
@@ -49,10 +49,10 @@ def test_setEntries(self):
4949
5050 def test_loadExtension (self ):
5151 fe = self .fg .add_item ()
52- fe .id ('1' )
53- fe .title (u'…' )
54- fe .content (u'…' )
55- fe .load_extension (' base' )
52+ fe .id ("1" )
53+ fe .title ("…" )
54+ fe .content ("…" )
55+ fe .load_extension (" base" )
5656 self .assertTrue (fe .base )
5757 self .assertTrue (self .fg .atom_str ())
5858
@@ -62,42 +62,41 @@ def test_checkEntryNumbers(self):
6262
6363 def test_TestEntryItems (self ):
6464 fe = self .fg .add_item ()
65- fe .title ('qwe' )
66- self .assertEqual (fe .title (), 'qwe' )
67- author = fe .author (email = 'ldoe@example.com' )[0 ]
68- self .assertFalse (author .get ('name' ))
69- self .assertEqual (author .get ('email' ), 'ldoe@example.com' )
70- author = fe .author (name = 'John Doe' , email = 'jdoe@example.com' ,
71- replace = True )[0 ]
72- self .assertEqual (author .get ('name' ), 'John Doe' )
73- self .assertEqual (author .get ('email' ), 'jdoe@example.com' )
74- contributor = fe .contributor (name = 'John Doe' , email = 'jdoe@ex.com' )[0 ]
65+ fe .title ("qwe" )
66+ self .assertEqual (fe .title (), "qwe" )
67+ author = fe .author (email = "ldoe@example.com" )[0 ]
68+ self .assertFalse (author .get ("name" ))
69+ self .assertEqual (author .get ("email" ), "ldoe@example.com" )
70+ author = fe .author (name = "John Doe" , email = "jdoe@example.com" , replace = True )[0 ]
71+ self .assertEqual (author .get ("name" ), "John Doe" )
72+ self .assertEqual (author .get ("email" ), "jdoe@example.com" )
73+ contributor = fe .contributor (name = "John Doe" , email = "jdoe@ex.com" )[0 ]
7574 self .assertEqual (contributor , fe .contributor ()[0 ])
76- self .assertEqual (contributor .get (' name' ), ' John Doe' )
77- self .assertEqual (contributor .get (' email' ), ' jdoe@ex.com' )
78- link = fe .link (href = ' http://lkiesow.de' , rel = ' alternate' )[0 ]
75+ self .assertEqual (contributor .get (" name" ), " John Doe" )
76+ self .assertEqual (contributor .get (" email" ), " jdoe@ex.com" )
77+ link = fe .link (href = " http://lkiesow.de" , rel = " alternate" )[0 ]
7978 self .assertEqual (link , fe .link ()[0 ])
80- self .assertEqual (link .get (' href' ), ' http://lkiesow.de' )
81- self .assertEqual (link .get (' rel' ), ' alternate' )
82- fe .guid (' 123' )
83- self .assertEqual (fe .guid ().get (' guid' ), ' 123' )
84- fe .updated (' 2017-02-05 13:26:58+01:00' )
79+ self .assertEqual (link .get (" href" ), " http://lkiesow.de" )
80+ self .assertEqual (link .get (" rel" ), " alternate" )
81+ fe .guid (" 123" )
82+ self .assertEqual (fe .guid ().get (" guid" ), " 123" )
83+ fe .updated (" 2017-02-05 13:26:58+01:00" )
8584 self .assertEqual (fe .updated ().year , 2017 )
86- fe .summary (' asdf' )
87- self .assertEqual (fe .summary (), {' summary' : ' asdf' })
88- fe .description (' asdfx' )
89- self .assertEqual (fe .description (), ' asdfx' )
90- fe .pubDate (' 2017-02-05 13:26:58+01:00' )
85+ fe .summary (" asdf" )
86+ self .assertEqual (fe .summary (), {" summary" : " asdf" })
87+ fe .description (" asdfx" )
88+ self .assertEqual (fe .description (), " asdfx" )
89+ fe .pubDate (" 2017-02-05 13:26:58+01:00" )
9190 self .assertEqual (fe .pubDate ().year , 2017 )
92- fe .rights (' asdfx' )
93- self .assertEqual (fe .rights (), ' asdfx' )
94- source = fe .source (url = ' https://example.com' , title = ' Test' )
95- self .assertEqual (source .get (' title' ), ' Test' )
96- self .assertEqual (source .get (' url' ), ' https://example.com' )
97- fe .comments (' asdfx' )
98- self .assertEqual (fe .comments (), ' asdfx' )
99- fe .enclosure (url = ' http://lkiesow.de' , type = ' text/plain' , length = '1' )
100- self .assertEqual (fe .enclosure ().get (' url' ), ' http://lkiesow.de' )
91+ fe .rights (" asdfx" )
92+ self .assertEqual (fe .rights (), " asdfx" )
93+ source = fe .source (url = " https://example.com" , title = " Test" )
94+ self .assertEqual (source .get (" title" ), " Test" )
95+ self .assertEqual (source .get (" url" ), " https://example.com" )
96+ fe .comments (" asdfx" )
97+ self .assertEqual (fe .comments (), " asdfx" )
98+ fe .enclosure (url = " http://lkiesow.de" , type = " text/plain" , length = "1" )
99+ self .assertEqual (fe .enclosure ().get (" url" ), " http://lkiesow.de" )
101100 fe .ttl (8 )
102101 self .assertEqual (fe .ttl (), 8 )
103102
@@ -114,67 +113,71 @@ def test_checkEntryContent(self):
114113
115114 def test_removeEntryByIndex (self ):
116115 fg = FeedGenerator ()
117- self .feedId = ' http://example.com'
118- self .title = ' Some Testfeed'
116+ self .feedId = " http://example.com"
117+ self .title = " Some Testfeed"
119118
120119 fe = fg .add_entry ()
121- fe .id (' http://lernfunk.de/media/654321/1' )
122- fe .title (' The Third Episode' )
120+ fe .id (" http://lernfunk.de/media/654321/1" )
121+ fe .title (" The Third Episode" )
123122 self .assertEqual (len (fg .entry ()), 1 )
124123 fg .remove_entry (0 )
125124 self .assertEqual (len (fg .entry ()), 0 )
126125
127126 def test_removeEntryByEntry (self ):
128127 fg = FeedGenerator ()
129- self .feedId = ' http://example.com'
130- self .title = ' Some Testfeed'
128+ self .feedId = " http://example.com"
129+ self .title = " Some Testfeed"
131130
132131 fe = fg .add_entry ()
133- fe .id (' http://lernfunk.de/media/654321/1' )
134- fe .title (' The Third Episode' )
132+ fe .id (" http://lernfunk.de/media/654321/1" )
133+ fe .title (" The Third Episode" )
135134
136135 self .assertEqual (len (fg .entry ()), 1 )
137136 fg .remove_entry (fe )
138137 self .assertEqual (len (fg .entry ()), 0 )
139138
140139 def test_categoryHasDomain (self ):
141140 fg = FeedGenerator ()
142- fg .title (' some title' )
143- fg .link (href = ' http://www.dontcare.com' , rel = ' alternate' )
144- fg .description (' description' )
141+ fg .title (" some title" )
142+ fg .link (href = " http://www.dontcare.com" , rel = " alternate" )
143+ fg .description (" description" )
145144 fe = fg .add_entry ()
146- fe .id ('http://lernfunk.de/media/654321/1' )
147- fe .title ('some title' )
148- fe .category ([
149- {'term' : 'category' ,
150- 'scheme' : 'http://somedomain.com/category' ,
151- 'label' : 'Category' ,
152- }])
145+ fe .id ("http://lernfunk.de/media/654321/1" )
146+ fe .title ("some title" )
147+ fe .category (
148+ [
149+ {
150+ "term" : "category" ,
151+ "scheme" : "http://somedomain.com/category" ,
152+ "label" : "Category" ,
153+ }
154+ ]
155+ )
153156
154157 result = fg .rss_str ()
155158 self .assertIn (b'domain="http://somedomain.com/category"' , result )
156159
157160 def test_content_cdata_type (self ):
158161 fg = FeedGenerator ()
159- fg .title (' some title' )
160- fg .id (' http://lernfunk.de/media/654322/1' )
162+ fg .title (" some title" )
163+ fg .id (" http://lernfunk.de/media/654322/1" )
161164 fe = fg .add_entry ()
162- fe .id (' http://lernfunk.de/media/654322/1' )
163- fe .title (' some title' )
164- fe .content (' content' , type = ' CDATA' )
165+ fe .id (" http://lernfunk.de/media/654322/1" )
166+ fe .title (" some title" )
167+ fe .content (" content" , type = " CDATA" )
165168 result = fg .atom_str ()
166169 expected = b'<content type="CDATA"><![CDATA[content]]></content>'
167170 self .assertIn (expected , result )
168171
169172 def test_summary_html_type (self ):
170173 fg = FeedGenerator ()
171- fg .title (' some title' )
172- fg .id (' http://lernfunk.de/media/654322/1' )
174+ fg .title (" some title" )
175+ fg .id (" http://lernfunk.de/media/654322/1" )
173176 fe = fg .add_entry ()
174- fe .id (' http://lernfunk.de/media/654322/1' )
175- fe .title (' some title' )
176- fe .link (href = ' http://lernfunk.de/media/654322/1' )
177- fe .summary (' <p>summary</p>' , type = ' html' )
177+ fe .id (" http://lernfunk.de/media/654322/1" )
178+ fe .title (" some title" )
179+ fe .link (href = " http://lernfunk.de/media/654322/1" )
180+ fe .summary (" <p>summary</p>" , type = " html" )
178181 result = fg .atom_str ()
179182 expected = b'<summary type="html"><p>summary</p></summary>'
180183 self .assertIn (expected , result )
0 commit comments