3371c2882f
This patch switches to the assert statements provided by Python's unit test framework to assure the statements are always executed and produce proper error messages in case of test failures.
31 lines
867 B
Python
31 lines
867 B
Python
import unittest
|
|
|
|
from feedgen.feed import FeedGenerator
|
|
|
|
|
|
class TestExtensionDc(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
self.fg = FeedGenerator()
|
|
self.fg.load_extension('dc')
|
|
self.fg.title('title')
|
|
self.fg.link(href='http://example.com', rel='self')
|
|
self.fg.description('description')
|
|
|
|
def test_entryLoadExtension(self):
|
|
fe = self.fg.add_item()
|
|
try:
|
|
fe.load_extension('dc')
|
|
except ImportError:
|
|
pass # Extension already loaded
|
|
|
|
def test_elements(self):
|
|
for method in dir(self.fg.dc):
|
|
if method.startswith('dc_'):
|
|
m = getattr(self.fg.dc, method)
|
|
m(method)
|
|
self.assertEqual(m(), [method])
|
|
|
|
self.fg.id('123')
|
|
self.assertTrue(self.fg.atom_str())
|
|
self.assertTrue(self.fg.rss_str())
|