<s> from __future__ import unicode_literals <EOL> from sure import scenario <EOL> from pyeqs import QuerySet <EOL> from pyeqs . dsl import Type <EOL> from tests . helpers import prepare_data , cleanup_data , add_document <EOL> @ scenario ( prepare_data , cleanup_data ) <EOL> def test_search_with_type ( context ) : <EOL> """<STR_LIT>""" <EOL> t = QuerySet ( "<STR_LIT:localhost>" , index = "<STR_LIT:foo>" ) <EOL> add_document ( "<STR_LIT:foo>" , { "<STR_LIT:bar>" : <NUM_LIT:1> } ) <EOL> add_document ( "<STR_LIT:foo>" , { "<STR_LIT:bar>" : <NUM_LIT:2> } ) <EOL> add_document ( "<STR_LIT:foo>" , { "<STR_LIT:bar>" : <NUM_LIT:3> } , doc_type = "<STR_LIT:bar>" ) <EOL> _type = Type ( "<STR_LIT:bar>" ) <EOL> t . filter ( _type ) <EOL> results = t [ <NUM_LIT:0> : <NUM_LIT:10> ] <EOL> len ( results ) . should . equal ( <NUM_LIT:1> ) <EOL> results [ <NUM_LIT:0> ] [ "<STR_LIT>" ] [ "<STR_LIT:bar>" ] . should . equal ( <NUM_LIT:3> ) </s>
