def test_at_location_multiple(tested): assert tested.at(Location(9, 13)) == [ GenericLabel(9, 13, document=document, i=6), GenericLabel(9, 13, document=document, i=7), ]
def test_at_location_not_found(tested): assert tested.at(Location(10, 10)) == []
def test_at_location(tested): assert tested.at(Location(2, 6))[0] == GenericLabel(2, 6, document=document, i=2)
def test_label_location(): l = GenericLabel(0, 10) assert l.location == Location(0, 10)
def test_location_equals(): assert Location(1, 3) == Location(1, 3)
def test_location_offset_by(): first = Location(0, 5) assert first.offset_by(10) == Location(10, 15) assert first.offset_by(Location(10, 25)) == Location(10, 15) assert first.offset_by(GenericLabel(10, 25)) == Location(10, 15)
def test_location_relative_to(): first = Location(10, 20) assert first.relative_to(5) == Location(5, 15) assert first.relative_to(GenericLabel(5, 25)) == Location(5, 15) assert first.relative_to(Location(5, 25)) == Location(5, 15)