Changeset - db6573f71b89
[Not reviewed]
default
0 2 0
Mads Kiilerich - 6 years ago 2019-12-22 20:28:00
mads@kiilerich.com
Grafted from: e407f1dcb58c
tests: fix ordering of get_inline_comments output

Py3 would give different ordering.
2 files changed with 16 insertions and 16 deletions:
0 comments (0 inline, 0 general)
kallithea/model/comment.py
Show inline comments
 
@@ -257,7 +257,7 @@ class ChangesetCommentsModel(object):
 
        paths = defaultdict(lambda: defaultdict(list))
 
        for co in comments:
 
            paths[co.f_path][co.line_no].append(co)
 
        return paths.items()
 
        return sorted(paths.items())
 

	
 
    def _get_comments(self, repo_id, revision=None, pull_request=None,
 
                inline=False, f_path=None, line_no=None):
kallithea/tests/models/test_comments.py
Show inline comments
 
@@ -126,15 +126,15 @@ class TestComments(TestController):
 
                    expected_len_comments=0, expected_len_inline_comments=2)
 
            # inline_comments is a list of tuples (file_path, dict)
 
            # where the dict keys are line numbers and values are lists of comments
 
            assert inline_comments[1][0] == f_path
 
            assert len(inline_comments[1][1]) == 2
 
            assert inline_comments[1][1][line_no][0].text == text
 
            assert inline_comments[1][1][line_no2][0].text == text2
 
            assert inline_comments[0][0] == f_path
 
            assert len(inline_comments[0][1]) == 2
 
            assert inline_comments[0][1][line_no][0].text == text
 
            assert inline_comments[0][1][line_no2][0].text == text2
 

	
 
            assert inline_comments[0][0] == f_path3
 
            assert len(inline_comments[0][1]) == 1
 
            assert line_no3 in inline_comments[0][1]
 
            assert inline_comments[0][1][line_no3][0].text == text3
 
            assert inline_comments[1][0] == f_path3
 
            assert len(inline_comments[1][1]) == 1
 
            assert line_no3 in inline_comments[1][1]
 
            assert inline_comments[1][1][line_no3][0].text == text3
 

	
 
            # now delete only one comment
 
            ChangesetCommentsModel().delete(new_comment2)
 
@@ -143,14 +143,14 @@ class TestComments(TestController):
 
                    expected_len_comments=0, expected_len_inline_comments=2)
 
            # inline_comments is a list of tuples (file_path, dict)
 
            # where the dict keys are line numbers and values are lists of comments
 
            assert inline_comments[1][0] == f_path
 
            assert len(inline_comments[1][1]) == 1
 
            assert inline_comments[1][1][line_no][0].text == text
 
            assert inline_comments[0][0] == f_path
 
            assert len(inline_comments[0][1]) == 1
 
            assert inline_comments[0][1][line_no][0].text == text
 

	
 
            assert inline_comments[0][0] == f_path3
 
            assert len(inline_comments[0][1]) == 1
 
            assert line_no3 in inline_comments[0][1]
 
            assert inline_comments[0][1][line_no3][0].text == text3
 
            assert inline_comments[1][0] == f_path3
 
            assert len(inline_comments[1][1]) == 1
 
            assert line_no3 in inline_comments[1][1]
 
            assert inline_comments[1][1][line_no3][0].text == text3
 

	
 
            # now delete all others
 
            ChangesetCommentsModel().delete(new_comment)
0 comments (0 inline, 0 general)