changeset 8852:252b86664549

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]
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 18 Aug 2020 21:22:32 +0200
parents 05406c312342
children 7b58d01e925a
files kallithea/tests/vcs/base.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/vcs/base.py	Thu Jan 14 21:44:53 2021 +0100
+++ b/kallithea/tests/vcs/base.py	Tue Aug 18 21:22:32 2020 +0200
@@ -73,10 +73,13 @@
 
         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'],