# HG changeset patch # User Mads Kiilerich # Date 2020-08-18 21:22:32 # Node ID 252b86664549ae747484efa24d84b7ef5bd21522 # Parent 05406c3123421a83eae688b6611530467b4929ad pytype: add some assertions to guide pytype through const dict with tricky typing structure These assertions also make the code more explicit and slightly more readable. Mute pytype warnings: File "kallithea/tests/vcs/base.py", line 76, in setup_repo: No attribute 'path' on str [attribute-error] In Union[kallithea.lib.vcs.nodes.FileNode, nothing, str] File "kallithea/tests/vcs/base.py", line 76, in setup_repo: No attribute 'content' on str [attribute-error] In Union[kallithea.lib.vcs.nodes.FileNode, nothing, str] diff --git a/kallithea/tests/vcs/base.py b/kallithea/tests/vcs/base.py --- a/kallithea/tests/vcs/base.py +++ b/kallithea/tests/vcs/base.py @@ -73,10 +73,13 @@ class _BackendTestMixin(object): for commit in cls._get_commits(): for node in commit.get('added', []): + assert isinstance(node, FileNode) cls.imc.add(FileNode(node.path, content=node.content)) for node in commit.get('changed', []): + assert isinstance(node, FileNode) cls.imc.change(FileNode(node.path, content=node.content)) for node in commit.get('removed', []): + assert isinstance(node, FileNode) cls.imc.remove(FileNode(node.path)) cls.tip = cls.imc.commit(message=commit['message'],