1. Georg Brandl
  2. sphinx-contrib

Commits

Sebastian Wiesner  committed 441167e

Simplified call checking

Use assert_called_with instead of manual call_args checking and removed
unnecessary called asserts

  • Participants
  • Parent commits c48cf96
  • Branches default

Comments (0)

Files changed (2)

File ansi/test_ansi.py

View file
 
 def test_setup(app):
     ansi.setup(app)
-    assert app.require_sphinx.called
-    assert app.require_sphinx.call_args[0] == ('1.0',)
-    assert app.add_config_value.called
-    assert app.add_config_value.call_args[0] == \
-           ('html_ansi_stylesheet', None, 'env')
-    assert app.add_directive.called
-    assert app.add_directive.call_args[0] == \
-           ('ansi-block', ansi.ANSIBlockDirective)
-    assert app.connect.called
+    app.require_sphinx.assert_called_with('1.0')
+    app.add_config_value.assert_called_with(
+        'html_ansi_stylesheet', None, 'env')
+    app.add_directive.assert_called_with(
+        'ansi-block', ansi.ANSIBlockDirective)
     assert app.connect.call_args_list[:2] == [
         (('builder-inited', ansi.add_stylesheet),),
         (('build-finished', ansi.copy_stylesheet),)]

File epydoc/test_epydoc.py

View file
     env.domains['py'].objtypes_for_role.return_value = ('foo', 'bar')
     assert resolve() is None
     assert app.warn.called
-    msg = ('ambiguous object types for %s, cannot resolve to epydoc')
-    assert app.warn.call_args[0] == (msg % (node['reftarget']),)
+    app.warn.assert_called_with('ambiguous object types for %s, cannot '
+                                'resolve to epydoc' % node['reftarget'])
 
 def test_resolve_reference_to_epydoc_success(resolve, node, env):
     env.domains['py'].objtypes_for_role.return_value = ('method',)
 
 def test_setup(app):
     epydoc.setup(app)
-    assert app.add_config_value.called
-    assert app.add_config_value.call_args[0] == ('epydoc_mapping',
-                                                 {}, 'env')
-    assert app.connect.called
-    assert app.connect.call_args[0] == \
-           ('missing-reference', epydoc.resolve_reference_to_epydoc)
+    app.add_config_value.assert_called_With('epydoc_mapping', {}, 'env')
+    app.connect.assert_called_with('missing-reference',
+                                   epydoc.resolve_reference_to_epydoc)
 
 
 def main():