'Tests the CONTAINS operator works with the query expression query method'

@execute_count(6)
def test_query_expression_success_case(self):

    q = IndexedCollectionsTestModel.filter(IndexedCollectionsTestModel.test_list.contains_(1))
    self.assertEqual(q.count(), 2)
    q = IndexedCollectionsTestModel.filter(IndexedCollectionsTestModel.test_list.contains_(13))
    self.assertEqual(q.count(), 0)
    q = IndexedCollectionsTestModel.filter(IndexedCollectionsTestModel.test_set.contains_(3))
    self.assertEqual(q.count(), 2)
    q = IndexedCollectionsTestModel.filter(IndexedCollectionsTestModel.test_set.contains_(13))
    self.assertEqual(q.count(), 0)
    q = IndexedCollectionsTestModel.filter(IndexedCollectionsTestModel.test_map.contains_(42))
    self.assertEqual(q.count(), 1)
    q = IndexedCollectionsTestModel.filter(IndexedCollectionsTestModel.test_map.contains_(13))
    self.assertEqual(q.count(), 0)
    with self.assertRaises(QueryException):
        q = IndexedCollectionsTestModel.filter(IndexedCollectionsTestModel.test_map_no_index.contains_(1))
        self.assertEqual(q.count(), 0)
    with self.assertRaises(QueryException):
        q = IndexedCollectionsTestModel.filter(IndexedCollectionsTestModel.test_map_no_index.contains_(1))
        self.assertEqual(q.count(), 0)
    with self.assertRaises(QueryException):
        q = IndexedCollectionsTestModel.filter(IndexedCollectionsTestModel.test_map_no_index.contains_(1))
        self.assertEqual(q.count(), 0)
