示例#1
0
    def test_combine(self):
        docs = [
            JSONFeatureInfoDoc('{}'),
            JSONFeatureInfoDoc('{"results": [{"foo": 1}]}'),
            JSONFeatureInfoDoc('{"results": [{"bar": 2}]}'),
        ]
        result = JSONFeatureInfoDoc.combine(docs)

        eq_('''{"results": [{"foo": 1}, {"bar": 2}]}''', result.as_string())
        eq_(result.info_type, 'json')
示例#2
0
    def test_combine_json(self):
        docs = [
            JSONFeatureInfoDoc("{}"),
            JSONFeatureInfoDoc('{"results": [{"foo": 1}]}'),
            JSONFeatureInfoDoc('{"results": [{"bar": 2}]}'),
        ]
        result, infotype = combine_docs(docs, None)

        assert """{"results": [{"foo": 1}, {"bar": 2}]}""" == result
        assert infotype == "json"
示例#3
0
    def test_combine(self):
        docs = [
            JSONFeatureInfoDoc("{}"),
            JSONFeatureInfoDoc('{"results": [{"foo": 1}]}'),
            JSONFeatureInfoDoc('{"results": [{"bar": 2}]}'),
        ]
        result = JSONFeatureInfoDoc.combine(docs)

        assert """{"results": [{"foo": 1}, {"bar": 2}]}""" == result.as_string(
        )
        assert result.info_type == "json"
示例#4
0
    def test_combine_mixed(self):
        docs = [
            JSONFeatureInfoDoc(b'{"results": [{"foo": 1}]}'),
            TextFeatureInfoDoc(b"Plain Text"),
        ]
        result, infotype = combine_docs(docs, None)

        assert b"""{"results": [{"foo": 1}]}\nPlain Text""" == result
        assert infotype == "text"
示例#5
0
    def test_combine(self):
        docs = [
            JSONFeatureInfoDoc('{}'),
            JSONFeatureInfoDoc('{"results": [{"foo": 1}]}'),
            JSONFeatureInfoDoc('{"results": [{"bar": 2}]}'),
        ]
        result = JSONFeatureInfoDoc.combine(docs)

        eq_('''{"results": [{"foo": 1}, {"bar": 2}]}''',
            result.as_string())
        eq_(result.info_type, 'json')