Example #1
0
    def test_DocumentExcerptField(self):
        class FakeValue(DocumentType):
            summary = 'just a summary'
            _highlight = {'content': ['this is <em>matching</em> text']}

        field = DocumentExcerptField()
        eq_(field.to_native(FakeValue()), 'this is <em>matching</em> text')

        class FakeValue(DocumentType):
            summary = 'just a summary'
            _highlight = {}

        eq_(field.to_native(FakeValue()), FakeValue.summary)
Example #2
0
    def test_DocumentExcerptField(self):

        class FakeValue(DocumentType):
            summary = 'just a summary'
            _highlight = {'content': ['this is <em>matching</em> text']}

        field = DocumentExcerptField()
        eq_(field.to_native(FakeValue()), 'this is <em>matching</em> text')

        class FakeValue(DocumentType):
            summary = 'just a summary'
            _highlight = {}

        eq_(field.to_native(FakeValue()), FakeValue.summary)
Example #3
0
    def test_DocumentExcerptField(self):
        class Meta(object):
            def __init__(self, highlight):
                self.highlight = highlight

        class FakeValue(DocumentType):
            summary = 'just a summary'
            es_meta = Meta({'content': ['this is <em>matching</em> text']})

        field = DocumentExcerptField()
        eq_(field.to_native(FakeValue()), 'this is <em>matching</em> text')

        class FakeValue(DocumentType):
            summary = 'just a summary'
            es_meta = Meta({})

        eq_(field.to_native(FakeValue()), FakeValue.summary)
Example #4
0
    def test_DocumentExcerptField(self):

        class Meta(object):
            def __init__(self, highlight):
                self.highlight = highlight

        class FakeValue(DocumentType):
            summary = 'just a summary'
            es_meta = Meta({'content': ['this is <em>matching</em> text']})

        field = DocumentExcerptField()
        eq_(field.to_native(FakeValue()), 'this is <em>matching</em> text')

        class FakeValue(DocumentType):
            summary = 'just a summary'
            es_meta = Meta({})

        eq_(field.to_native(FakeValue()), FakeValue.summary)