From 3c2598d9f2cb2bef75bf378e915492f58752022c Mon Sep 17 00:00:00 2001 From: Lukas Masuch Date: Wed, 25 Nov 2020 23:18:10 +0100 Subject: [PATCH] Add additional tests based on hashes --- tests/test_generation.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/tests/test_generation.py b/tests/test_generation.py index 45a6dc4..e0de0da 100644 --- a/tests/test_generation.py +++ b/tests/test_generation.py @@ -6,5 +6,32 @@ def test_import2md() -> None: generator = MarkdownGenerator() markdown = generator.import2md(MarkdownGenerator.import2md) - md_hash = hashlib.md5(markdown.encode("utf-8")).hexdigest() - assert md_hash == "4a2b89327414077031d103b4cf6672b6" + # Remove whitespaces: fix changes between py version 3.6 3.7 in signature method + md_hash = hashlib.md5(markdown.replace(" ", "").encode("utf-8")).hexdigest() + assert md_hash == "4f5254f4be4158f984b7a9741d118698" + + +def test_class2md() -> None: + generator = MarkdownGenerator() + markdown = generator.class2md(MarkdownGenerator) + # Remove whitespaces: fix changes between py version 3.6 3.7 in signature method + md_hash = hashlib.md5(markdown.replace(" ", "").encode("utf-8")).hexdigest() + assert md_hash == "ea0ad63a9018a85d8d76f9a6ad7f7985" + + +def test_module2md() -> None: + generator = MarkdownGenerator() + from lazydocs import generation + + markdown = generator.module2md(generation) + # Remove whitespaces: fix changes between py version 3.6 3.7 in signature method + md_hash = hashlib.md5(markdown.replace(" ", "").encode("utf-8")).hexdigest() + assert md_hash == "f6a3d5a8cd05f9f97adedbbe5d212fa2" + + +def test_func2md() -> None: + generator = MarkdownGenerator() + markdown = generator.func2md(MarkdownGenerator.func2md) + # Remove whitespaces: fix changes between py version 3.6 3.7 in signature method + md_hash = hashlib.md5(markdown.replace(" ", "").encode("utf-8")).hexdigest() + assert md_hash == "797bad8c00ee6f189cb6f578eaec02c4"