コード例 #1
0
    def test_init(self):
        """Testing ParsedDiffChange.__init__"""
        parser = BaseDiffParser(b'')
        parsed_diff = ParsedDiff(parser=parser)
        parsed_diff_change = ParsedDiffChange(parsed_diff=parsed_diff)

        self.assertEqual(parsed_diff.changes, [parsed_diff_change])
        self.assertIs(parsed_diff_change.parent_parsed_diff, parsed_diff)
コード例 #2
0
    def test_init_with_parsed_diff_change(self):
        """Testing ParsedDiffFile.__init__ with parsed_diff_change="""
        parser = BaseDiffParser(b'')
        parsed_diff = ParsedDiff(parser=parser)
        parsed_diff_change = ParsedDiffChange(parsed_diff=parsed_diff)
        parsed_diff_file = ParsedDiffFile(
            parsed_diff_change=parsed_diff_change)

        self.assertIs(parsed_diff_file.parser, parser)
        self.assertEqual(parsed_diff_change.files, [parsed_diff_file])
        self.assertEqual(parsed_diff_file.parent_parsed_diff_change,
                         parsed_diff_change)
コード例 #3
0
    def test_init_with_parser(self):
        """Testing ParsedDiffFile.__init__ with parser="""
        parser = BaseDiffParser(b'')

        message = (
            'Diff parsers must pass a ParsedDiffChange as the '
            'parsed_diff_change= parameter when creating a ParsedDiffFile. '
            'They should no longer pass a parser= parameter. This will be '
            'mandatory in Review Board 5.0.')

        with self.assertWarns(cls=RemovedInReviewBoard50Warning,
                              message=message):
            parsed_diff_file = ParsedDiffFile(parser=parser)

        self.assertIs(parsed_diff_file.parser, parser)
        self.assertIsNone(parsed_diff_file.parent_parsed_diff_change)
コード例 #4
0
    def test_init(self):
        """Testing ParsedDiff.__init__"""
        parser = BaseDiffParser(b'')
        parsed_diff = ParsedDiff(parser=parser)

        self.assertIs(parsed_diff.parser, parser)