def test_set_source_model():
 model1 = base.BaseCompletionModel()
 model2 = base.BaseCompletionModel()
 filter_model = sortfilter.CompletionFilterModel(model1)
 filter_model.set_pattern('foo')
 assert (filter_model.srcmodel is model1)
 assert (filter_model.sourceModel() is model1)
 assert (filter_model.pattern == 'foo')
 filter_model.setSourceModel(model2)
 assert (filter_model.srcmodel is model2)
 assert (filter_model.sourceModel() is model2)
 assert (not filter_model.pattern)

def test_set_source_model ( ) : model1 = base . BaseCompletionModel ( ) model2 = base . BaseCompletionModel ( ) filter_model = sortfilter . CompletionFilterModel ( model1 ) filter_model . set_pattern ( 'foo' ) assert ( filter_model . srcmodel is model1 ) assert ( filter_model . sourceModel ( ) is model1 ) assert ( filter_model . pattern == 'foo' ) filter_model . setSourceModel ( model2 ) assert ( filter_model . srcmodel is model2 ) assert ( filter_model . sourceModel ( ) is model2 ) assert ( not filter_model . pattern )
ensure setsourcemodel sets source_model and clears the pattern .