def testModuleImportError(self): config = dict(Extensions=dict(disable_defaults=True, foo='default')) with self.assertRaises(exceptions.MooseDocsException) as e: _yaml_load_extensions(config) self.assertIn("Failed to import the supplied 'foo' module.", str(e.exception))
def testMissingTypeError(self, mock): config = dict(Extensions=dict(disable_defaults=True, foo=dict())) ext = _yaml_load_extensions(config) self.assertEqual(ext, []) mock.assert_called_once() args, _ = mock.call_args self.assertIn("The section '%s' must contain a 'type' parameter.", args[0])
def testModuleImportError(self): config = dict(Extensions=dict(disable_defaults=True, foo=dict(type='Bad'))) with self.assertRaises(exceptions.MooseDocsException) as e: _yaml_load_extensions(config) self.assertIn("Failed to import the supplied 'Bad' module.", e.exception.message)
def testDisableDefaults(self): config = dict(Extensions=dict(disable_defaults=True)) ext = _yaml_load_extensions(config) self.assertEqual(ext, [])
def testEmpty(self): ext = _yaml_load_extensions(dict()) names = set([e.__module__ for e in ext]) self.assertEqual(names, set(DEFAULT_EXTENSIONS))