def test_with_empty_db(self, progressbar): """ Adding no entries does not cause an error. """ parser = FakeParser(doc_path=u"foo") toc = patch_anchors(parser, show_progressbar=progressbar) toc.close()
def test_with_empty_db(self, progressbar): """ Adding no entries does not cause an error. """ parser = TestParser(doc_path=u"foo") toc = patch_anchors(parser, show_progressbar=progressbar) toc.close()
def test_complains(self, entries, tmpdir): """ If patching fails, a debug message is logged. """ foo = tmpdir.mkdir("foo") foo.join("bar.html").write("docs!") parser = FakeParser(doc_path=six.text_type(foo), succeed_patching=False) toc = patch_anchors(parser, show_progressbar=False) for e in entries: toc.send(e) with patch("doc2dash.parsers.utils.log.debug") as mock: toc.close() assert mock.call_count == 1
def test_single_entry(self, monkeypatch, tmpdir, entries): """ Only entries with URL anchors get patched. """ foo = tmpdir.mkdir("foo") foo.join("bar.html").write("docs!") parser = FakeParser(doc_path=six.text_type(foo)) toc = patch_anchors(parser, show_progressbar=False) for e in entries: print(e) toc.send(e) toc.close() assert [TOCEntry(name=u"foo", type=u"Method", anchor=u"foo")] == parser._patched_entries
def test_complains(self, entries, tmpdir): """ If patching fails, a debug message is logged. """ foo = tmpdir.mkdir("foo") foo.join("bar.html").write("docs!") parser = FakeParser(doc_path=str(foo), succeed_patching=False) toc = patch_anchors(parser, show_progressbar=False) for e in entries: toc.send(e) with patch("doc2dash.parsers.utils.log.debug") as mock: toc.close() assert mock.call_count == 1
def test_single_entry(self, monkeypatch, tmpdir, entries): """ Only entries with URL anchors get patched. """ foo = tmpdir.mkdir("foo") foo.join("bar.html").write("docs!") parser = FakeParser(doc_path=str(foo)) toc = patch_anchors(parser, show_progressbar=False) for e in entries: print(e) toc.send(e) toc.close() assert [TOCEntry(name="foo", type="Method", anchor="foo")] == parser._patched_entries