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", [])], )
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", [])])
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' }])])
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', [])])
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'}])])
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"}]), ], )