Skip to content

Commit 47a5662

Browse files
gfairchildclaude
andcommitted
test empty string as invalid ID/type in addition to None
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3b9eca9 commit 47a5662

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

tests/test_yelpapi.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ def test_success(self, yelp, faker, mock_request, random_dict):
117117

118118

119119
class TestBusinessQuery:
120-
def test_requires_id(self, yelp):
120+
@pytest.mark.parametrize('invalid_id', [None, ''])
121+
def test_requires_id(self, yelp, invalid_id):
121122
with pytest.raises(ValueError):
122-
yelp.business_query(None)
123+
yelp.business_query(invalid_id)
123124

124125
def test_success(self, yelp, faker, mock_request, random_dict):
125126
business_id = faker.pystr()
@@ -156,9 +157,10 @@ def test_success(self, yelp, faker, mock_request, random_dict):
156157

157158

158159
class TestEventLookupQuery:
159-
def test_requires_id(self, yelp):
160+
@pytest.mark.parametrize('invalid_id', [None, ''])
161+
def test_requires_id(self, yelp, invalid_id):
160162
with pytest.raises(ValueError):
161-
yelp.event_lookup_query(None)
163+
yelp.event_lookup_query(invalid_id)
162164

163165
def test_success(self, yelp, faker, mock_request, random_dict):
164166
event_id = faker.pystr()
@@ -197,9 +199,10 @@ def test_success(self, yelp, faker, mock_request, random_dict):
197199

198200

199201
class TestReviewsQuery:
200-
def test_requires_id(self, yelp):
202+
@pytest.mark.parametrize('invalid_id', [None, ''])
203+
def test_requires_id(self, yelp, invalid_id):
201204
with pytest.raises(ValueError):
202-
yelp.reviews_query(None)
205+
yelp.reviews_query(invalid_id)
203206

204207
def test_success(self, yelp, faker, mock_request, random_dict):
205208
business_id = faker.pystr()
@@ -231,9 +234,10 @@ def test_success(self, yelp, faker, mock_request, random_dict):
231234

232235

233236
class TestTransactionSearchQuery:
234-
def test_requires_transaction_type(self, yelp, faker):
237+
@pytest.mark.parametrize('invalid_type', [None, ''])
238+
def test_requires_transaction_type(self, yelp, faker, invalid_type):
235239
with pytest.raises(ValueError):
236-
yelp.transaction_search_query(None, location=faker.city())
240+
yelp.transaction_search_query(invalid_type, location=faker.city())
237241

238242
def test_requires_location_or_lat_lng(self, yelp, faker):
239243
with pytest.raises(ValueError):

0 commit comments

Comments
 (0)