Beispiel #1
0
def test_annotation_selector_serialize_missing_text_quote_selector():
    t = types.AnnotationSelectorJSONB()
    selectors = [{
        'type': 'RangeSelector',
        'startContainer': '/div[1]/div[2]',
        'endContainer': '/div[1]/div[3]',
        'startOffset': 39,
        'endoffset': 1
    }]
    assert t.process_bind_param(selectors, dialect) == selectors
Beispiel #2
0
def test_annotation_selector_deserialize():
    t = types.AnnotationSelectorJSONB()
    selectors = [{
        'type': 'TextQuoteSelector',
        'prefix': u'\\u0000Lorem ipsum ',
        'exact': u'dolor sit amet,\\u0000 ',
        'suffix': u'consectetur\\u0000 adipiscing elit.'
    }]

    value = t.process_result_value(selectors, dialect)
    assert value[0]['prefix'] == u'\u0000Lorem ipsum '
    assert value[0]['exact'] == u'dolor sit amet,\u0000 '
    assert value[0]['suffix'] == u'consectetur\u0000 adipiscing elit.'