comparison test/test_cgi.py @ 5453:2b4f606d8e72

use exception.args instead of exception.message
author Christof Meerwald <cmeerw@cmeerw.org>
date Mon, 23 Jul 2018 21:39:46 +0100
parents 55f09ca366c4
children e903835f0822
comparison
equal deleted inserted replaced
5452:b50a4c85c270 5453:2b4f606d8e72
1641 ''' test the examine_url function ''' 1641 ''' test the examine_url function '''
1642 1642
1643 def te(url, exception, raises=ValueError): 1643 def te(url, exception, raises=ValueError):
1644 with self.assertRaises(raises) as cm: 1644 with self.assertRaises(raises) as cm:
1645 examine_url(url) 1645 examine_url(url)
1646 self.assertEqual(cm.exception.message, exception) 1646 self.assertEqual(cm.exception.args, (exception,))
1647 1647
1648 1648
1649 action = actions.Action(self.client) 1649 action = actions.Action(self.client)
1650 examine_url = action.examine_url 1650 examine_url = action.examine_url
1651 1651
1784 1784
1785 # test case where there is no view so generic template can't 1785 # test case where there is no view so generic template can't
1786 # be determined. 1786 # be determined.
1787 with self.assertRaises(NoTemplate) as cm: 1787 with self.assertRaises(NoTemplate) as cm:
1788 t.selectTemplate("user", "") 1788 t.selectTemplate("user", "")
1789 self.assertEqual(cm.exception.message, 1789 self.assertEqual(cm.exception.args,
1790 '''Template "user" doesn't exist''') 1790 ('''Template "user" doesn't exist''',))
1791 1791
1792 # there is no html/subdir/user.item.{,xml,html} so it will 1792 # there is no html/subdir/user.item.{,xml,html} so it will
1793 # raise NoTemplate. 1793 # raise NoTemplate.
1794 self.assertRaises(NoTemplate, 1794 self.assertRaises(NoTemplate,
1795 t.selectTemplate, "user", "subdir/item") 1795 t.selectTemplate, "user", "subdir/item")

Roundup Issue Tracker: http://roundup-tracker.org/