@@ -28,51 +28,39 @@ def test_get_typo_tolerance_default(empty_index):
28
28
def test_update_typo_tolerance (empty_index ):
29
29
"""Tests updating typo_tolerance."""
30
30
index = empty_index ()
31
+ response_update = index .update_typo_tolerance (NEW_TYPO_TOLERANCE )
32
+ update = index .wait_for_task (response_update ['uid' ])
33
+ response_get = index .get_typo_tolerance ()
31
34
32
- response = index .update_typo_tolerance (NEW_TYPO_TOLERANCE )
33
-
34
- assert isinstance (response , dict )
35
- assert 'uid' in response
36
-
37
- update = index .wait_for_task (response ['uid' ])
38
-
35
+ assert isinstance (response_update , dict )
36
+ assert 'uid' in response_update
39
37
assert update ['status' ] == 'succeeded'
40
-
41
- response = index .get_typo_tolerance ()
42
-
43
- assert isinstance (response , dict )
38
+ assert isinstance (response_get , dict )
44
39
for typo_tolerance in NEW_TYPO_TOLERANCE :
45
- assert typo_tolerance in response
46
- assert NEW_TYPO_TOLERANCE [typo_tolerance ] == response [typo_tolerance ]
40
+ assert typo_tolerance in response_get
41
+ assert NEW_TYPO_TOLERANCE [typo_tolerance ] == response_get [typo_tolerance ]
47
42
48
43
def test_reset_typo_tolerance (empty_index ):
49
44
"""Tests resetting the typo_tolerance setting to its default value."""
50
45
index = empty_index ()
51
46
52
- # Update the settings first
53
- response = index .update_typo_tolerance (NEW_TYPO_TOLERANCE )
54
- update = index .wait_for_task (response ['uid' ])
55
-
56
- assert update ['status' ] == 'succeeded'
57
-
58
- # Check the settings have been correctly updated
59
- response = index .get_typo_tolerance ()
60
-
61
- assert isinstance (response , dict )
47
+ # Update the settings
48
+ response_update = index .update_typo_tolerance (NEW_TYPO_TOLERANCE )
49
+ update1 = index .wait_for_task (response_update ['uid' ])
50
+ # Get the setting after update
51
+ response_get = index .get_typo_tolerance ()
52
+ # Reset the setting
53
+ response_reset = index .reset_typo_tolerance ()
54
+ update2 = index .wait_for_task (response_reset ['uid' ])
55
+ # Get the setting after reset
56
+ response_last = index .get_typo_tolerance ()
57
+
58
+ assert update1 ['status' ] == 'succeeded'
59
+ assert isinstance (response_get , dict )
62
60
for typo_tolerance in NEW_TYPO_TOLERANCE :
63
- assert typo_tolerance in response
64
- assert NEW_TYPO_TOLERANCE [typo_tolerance ] == response [typo_tolerance ]
65
-
66
- # Check the reset of the settings
67
- response = index .reset_typo_tolerance ()
68
-
69
- assert isinstance (response , dict )
70
- assert 'uid' in response
71
-
72
- update = index .wait_for_task (response ['uid' ])
73
-
74
- assert update ['status' ] == 'succeeded'
75
-
76
- response = index .get_typo_tolerance ()
77
-
78
- assert response == DEFAULT_TYPO_TOLERANCE
61
+ assert typo_tolerance in response_get
62
+ assert NEW_TYPO_TOLERANCE [typo_tolerance ] == response_get [typo_tolerance ]
63
+ assert isinstance (response_reset , dict )
64
+ assert 'uid' in response_reset
65
+ assert update2 ['status' ] == 'succeeded'
66
+ assert response_last == DEFAULT_TYPO_TOLERANCE
0 commit comments