11import pytest
22import meilisearch
33from meilisearch .tests import BASE_URL , MASTER_KEY , clear_all_indexes
4+ from meilisearch .index import Index
5+
46
57class TestIndex :
68
@@ -18,23 +20,23 @@ def setup_class(self):
1820 def test_create_index (self ):
1921 """Tests creating an index"""
2022 index = self .client .create_index (uid = self .index_uid )
21- assert isinstance (index , object )
23+ assert isinstance (index , Index )
2224 assert index .uid == self .index_uid
2325 assert index .primary_key is None
2426 assert index .get_primary_key () is None
2527
2628 def test_create_index_with_primary_key (self ):
2729 """Tests creating an index with a primary key"""
2830 index = self .client .create_index (uid = self .index_uid2 , options = {'primaryKey' : 'book_id' })
29- assert isinstance (index , object )
31+ assert isinstance (index , Index )
3032 assert index .uid == self .index_uid2
3133 assert index .primary_key == 'book_id'
3234 assert index .get_primary_key () == 'book_id'
3335
3436 def test_create_index_with_uid_in_options (self ):
3537 """Tests creating an index with a primary key"""
3638 index = self .client .create_index (uid = self .index_uid3 , options = {'uid' : 'wrong' , 'primaryKey' : 'book_id' })
37- assert isinstance (index , object )
39+ assert isinstance (index , Index )
3840 assert index .uid == self .index_uid3
3941 assert index .primary_key == 'book_id'
4042 assert index .get_primary_key () == 'book_id'
@@ -51,7 +53,7 @@ def test_get_indexes(self):
5153
5254 def test_index_with_any_uid (self ):
5355 index = self .client .index ('anyUID' )
54- assert isinstance (index , object )
56+ assert isinstance (index , Index )
5557 assert index .uid == 'anyUID'
5658 assert index .primary_key is None
5759 assert index .config is not None
@@ -64,7 +66,7 @@ def test_index_with_none_uid(self):
6466 def test_get_index_with_valid_uid (self ):
6567 """Tests getting one index with uid"""
6668 response = self .client .get_index (uid = self .index_uid )
67- assert isinstance (response , object )
69+ assert isinstance (response , Index )
6870 assert response .uid == self .index_uid
6971
7072 def test_get_index_with_none_uid (self ):
@@ -110,7 +112,7 @@ def test_index_fetch_info(self):
110112 """Tests getting the index info"""
111113 index = self .client .index (uid = self .index_uid )
112114 response = index .fetch_info ()
113- assert isinstance (response , object )
115+ assert isinstance (response , Index )
114116 assert response .uid == self .index_uid
115117 assert response .primary_key is None
116118 assert response .primary_key == index .primary_key
@@ -120,7 +122,7 @@ def test_index_fetch_info_containing_primary_key(self):
120122 """Tests getting the index info"""
121123 index = self .client .index (uid = self .index_uid3 )
122124 response = index .fetch_info ()
123- assert isinstance (response , object )
125+ assert isinstance (response , Index )
124126 assert response .uid == self .index_uid3
125127 assert response .primary_key == 'book_id'
126128 assert response .primary_key == index .primary_key
@@ -139,7 +141,7 @@ def test_update_index(self):
139141 """Tests updating an index"""
140142 index = self .client .index (uid = self .index_uid )
141143 response = index .update (primaryKey = 'objectID' )
142- assert isinstance (response , object )
144+ assert isinstance (response , Index )
143145 assert response .uid == index .uid
144146 assert response .primary_key == index .primary_key
145147 assert index .primary_key == 'objectID'
0 commit comments