Пример #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)
Пример #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)
Пример #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)
Пример #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)