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')
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"
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"
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"