11"""Tests for variable label field across all variable endpoints."""
22
3- import pytest
4-
5- from test_fixtures .fixtures_variables import ( # noqa: F811
3+ from test_fixtures .fixtures_variables import (
64 create_variable ,
7- uk_model_version ,
8- us_model_version ,
95)
10-
6+ from test_fixtures .fixtures_variables import (
7+ uk_model_version as uk_model_version , # noqa: F811
8+ )
9+ from test_fixtures .fixtures_variables import (
10+ us_model_version as us_model_version , # noqa: F811
11+ )
1112
1213# ---------------------------------------------------------------------------
1314# GET /variables - label in list responses
@@ -18,7 +19,10 @@ class TestListVariablesLabel:
1819 """Tests that label is returned when listing variables."""
1920
2021 def test_label_returned_in_response (
21- self , client , session , us_model_version # noqa: F811
22+ self ,
23+ client ,
24+ session ,
25+ us_model_version , # noqa: F811
2226 ):
2327 """Variable with a label should include it in the list response."""
2428 create_variable (
@@ -35,7 +39,10 @@ def test_label_returned_in_response(
3539 assert data [0 ]["label" ] == "Employment income"
3640
3741 def test_null_label_returned_when_absent (
38- self , client , session , us_model_version # noqa: F811
42+ self ,
43+ client ,
44+ session ,
45+ us_model_version , # noqa: F811
3946 ):
4047 """Variable without a label should return null."""
4148 create_variable (
@@ -52,7 +59,10 @@ def test_null_label_returned_when_absent(
5259 assert data [0 ]["label" ] is None
5360
5461 def test_empty_label_returned (
55- self , client , session , us_model_version # noqa: F811
62+ self ,
63+ client ,
64+ session ,
65+ us_model_version , # noqa: F811
5666 ):
5767 """Variable with an empty string label should return it as-is."""
5868 create_variable (
@@ -76,7 +86,10 @@ class TestSearchVariablesByLabel:
7686 """Tests that the search parameter matches against labels."""
7787
7888 def test_search_matches_label (
79- self , client , session , us_model_version # noqa: F811
89+ self ,
90+ client ,
91+ session ,
92+ us_model_version , # noqa: F811
8093 ):
8194 """Searching for a term in the label should return the variable."""
8295 create_variable (
@@ -105,7 +118,10 @@ def test_search_matches_label(
105118 assert data [0 ]["name" ] == "employment_income"
106119
107120 def test_search_label_case_insensitive (
108- self , client , session , us_model_version # noqa: F811
121+ self ,
122+ client ,
123+ session ,
124+ us_model_version , # noqa: F811
109125 ):
110126 """Label search should be case-insensitive."""
111127 create_variable (
@@ -126,7 +142,10 @@ def test_search_label_case_insensitive(
126142 assert len (response .json ()) == 1
127143
128144 def test_search_partial_label_match (
129- self , client , session , us_model_version # noqa: F811
145+ self ,
146+ client ,
147+ session ,
148+ us_model_version , # noqa: F811
130149 ):
131150 """Partial label matches should be returned."""
132151 create_variable (
@@ -156,7 +175,10 @@ class TestGetVariableLabel:
156175 """Tests that label is returned when fetching a single variable."""
157176
158177 def test_label_in_get_response (
159- self , client , session , us_model_version # noqa: F811
178+ self ,
179+ client ,
180+ session ,
181+ us_model_version , # noqa: F811
160182 ):
161183 """GET /variables/{id} should include the label field."""
162184 var = create_variable (
@@ -171,7 +193,10 @@ def test_label_in_get_response(
171193 assert response .json ()["label" ] == "Employment income"
172194
173195 def test_null_label_in_get_response (
174- self , client , session , us_model_version # noqa: F811
196+ self ,
197+ client ,
198+ session ,
199+ us_model_version , # noqa: F811
175200 ):
176201 """GET /variables/{id} should return null for missing label."""
177202 var = create_variable (
@@ -195,7 +220,10 @@ class TestVariablesByNameLabel:
195220 """Tests that label is included in by-name lookup responses."""
196221
197222 def test_label_in_by_name_response (
198- self , client , session , us_model_version # noqa: F811
223+ self ,
224+ client ,
225+ session ,
226+ us_model_version , # noqa: F811
199227 ):
200228 """POST /variables/by-name should include the label field."""
201229 create_variable (
@@ -215,7 +243,10 @@ def test_label_in_by_name_response(
215243 assert data [0 ]["label" ] == "Employment income"
216244
217245 def test_mixed_labels_in_by_name_response (
218- self , client , session , us_model_version # noqa: F811
246+ self ,
247+ client ,
248+ session ,
249+ us_model_version , # noqa: F811
219250 ):
220251 """Variables with and without labels should both be returned correctly."""
221252 create_variable (
0 commit comments