Mercurial > p > roundup > code
changeset 7966:1e38ca6fb16e
test: clean up test for deprecation of xhtml.
xhtml was used as a value in a test. Choose different value for
testing.
Also add test to verify that xhtml use raises an error.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 14 May 2024 22:35:56 -0400 |
| parents | 6763813d9d34 |
| children | 70703d22c79a |
| files | test/test_config.py |
| diffstat | 1 files changed, 22 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/test/test_config.py Tue May 14 21:27:28 2024 -0400 +++ b/test/test_config.py Tue May 14 22:35:56 2024 -0400 @@ -944,8 +944,8 @@ print(cm.exception) self.assertEqual(cm.exception.args[0], self.dirname) - def testCopyConfig(self): + def testXhtmlRaisesOptionError(self): self.munge_configini(mods=[ ("html_version = ", "xhtml") ]) config = configuration.CoreConfig() @@ -953,17 +953,34 @@ # verify config is initalized to defaults self.assertEqual(config['HTML_VERSION'], 'html4') + + with self.assertRaises(configuration.OptionValueError) as cm: + # load config + config.load(self.dirname) + + print(cm.exception) + self.assertEqual(str(cm.exception), + "Invalid value for HTML_VERSION: 'xhtml'\n" + "Allowed values: html4") + + def testCopyConfig(self): + + self.munge_configini(mods=[ ("static_files = ", "html2") ]) + + config = configuration.CoreConfig() + + # verify config is initalized to defaults + self.assertEqual(config['STATIC_FILES'], None) + # load config config.load(self.dirname) - - # loaded new option - self.assertEqual(config['HTML_VERSION'], 'xhtml') + self.assertEqual(config['STATIC_FILES'], ['_test_instance/html2']) # copy config config_copy = config.copy() # this should work - self.assertEqual(config_copy['HTML_VERSION'], 'xhtml') + self.assertEqual(config_copy['STATIC_FILES'], ['_test_instance/html2']) @skip_py2 def testConfigValueInterpolateError(self):
