示例#1
0
    def test_display_docstring(self):
        class FakeClass(CMD):
            "docstring!"

        with patch.object(sys.stdout, "write") as mock_method:
            ListEntrypoint().display(FakeClass)
            mock_method.assert_any_call("docstring!")
示例#2
0
    def test_display_no_docstring(self):
        class FakeClass(CMD):
            pass

        with patch.object(sys.stdout, "write") as mock_method:
            ListEntrypoint().display(FakeClass)
            with self.assertRaisesRegex(AssertionError, "call not found"):
                mock_method.assert_any_call("docstring!")