示例#1
0
文件: test_build.py 项目: B-Rich/dxr
 def test_none(self):
     """If there are no annotations, or if the annotations run short of the
     lines, don't stop emitting lines."""
     eq_(
         self._expand_group(lines_and_annotations(["one", "two"], [Htmlifier(annotations=[])])),
         [("one", []), ("two", [])],
     )
示例#2
0
文件: test_build.py 项目: B-Rich/dxr
    def test_jump_ahead(self):
        """Make sure annotations show up on the correct line even when there is
        no annotation for the first line."""
        h1 = Htmlifier(annotations=[(3, {"e": "f"})])

        results = self._expand_group(lines_and_annotations(["one", "two", "three", "four"], [h1]))
        eq_(results, [("one", []), ("two", []), ("three", [{"e": "f"}]), ("four", [])])
示例#3
0
    def test_sanity(self):
        """Make sure annotations are pulled from htmlifiers and paired with HTML
        lines sanely, handling sparsely distributed annotations and multiple
        htmlifiers annotating a single line."""
        h1 = Htmlifier(annotations=[(1, {
            'a': 'b'
        }), (3, {
            'e': 'f'
        }), (6, {
            'g': 'h'
        })])
        h2 = Htmlifier(annotations=[(1, {'c': 'd'})])

        results = self._expand_group(
            lines_and_annotations(
                ['one', 'two', 'three', 'four', 'five', 'six'], [h1, h2]))
        eq_(results, [('one', [{
            'a': 'b'
        }, {
            'c': 'd'
        }]), ('two', []), ('three', [{
            'e': 'f'
        }]), ('four', []), ('five', []), ('six', [{
            'g': 'h'
        }])])
示例#4
0
 def test_none(self):
     """If there are no annotations, or if the annotations run short of the
     lines, don't stop emitting lines."""
     eq_(
         self._expand_group(
             lines_and_annotations(['one', 'two'],
                                   [Htmlifier(annotations=[])])),
         [('one', []), ('two', [])])
示例#5
0
    def test_sanity(self):
        """Make sure annotations are pulled from htmlifiers and paired with HTML
        lines sanely, handling sparsely distributed annotations and multiple
        htmlifiers annotating a single line."""
        h1 = Htmlifier(annotations=[(1, {'a': 'b'}), (3, {'e': 'f'}), (6, {'g': 'h'})])
        h2 = Htmlifier(annotations=[(1, {'c': 'd'})])

        results = self._expand_group(lines_and_annotations(
                    ['one', 'two', 'three', 'four', 'five', 'six'], [h1, h2]))
        eq_(results,
            [('one', [{'a': 'b'}, {'c': 'd'}]),
             ('two', []),
             ('three', [{'e': 'f'}]),
             ('four', []),
             ('five', []),
             ('six', [{'g': 'h'}])])
示例#6
0
文件: test_build.py 项目: B-Rich/dxr
    def test_sanity(self):
        """Make sure annotations are pulled from htmlifiers and paired with HTML
        lines sanely, handling sparsely distributed annotations and multiple
        htmlifiers annotating a single line."""
        h1 = Htmlifier(annotations=[(1, {"a": "b"}), (3, {"e": "f"}), (6, {"g": "h"})])
        h2 = Htmlifier(annotations=[(1, {"c": "d"})])

        results = self._expand_group(lines_and_annotations(["one", "two", "three", "four", "five", "six"], [h1, h2]))
        eq_(
            results,
            [
                ("one", [{"a": "b"}, {"c": "d"}]),
                ("two", []),
                ("three", [{"e": "f"}]),
                ("four", []),
                ("five", []),
                ("six", [{"g": "h"}]),
            ],
        )