Changeset - 252b86664549
[Not reviewed]
default
0 1 0
Mads Kiilerich (mads) - 6 years ago 2020-08-18 21:22:32
mads@kiilerich.com
Grafted from: 495e01340f5a
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]
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/vcs/base.py
Show inline comments
 
@@ -70,16 +70,19 @@ class _BackendTestMixin(object):
 
        cls.repo = cls.setup_empty_repo(backend)
 
        cls.imc = cls.repo.in_memory_changeset
 
        cls.default_branch = cls.repo.DEFAULT_BRANCH_NAME
 

	
 
        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'],
 
                                     author=commit['author'],
 
                                     date=commit['date'])
 

	
0 comments (0 inline, 0 general)