@@ -124,6 +124,53 @@ def test_search_items_returns_offers_v2(self) -> None:
124124 listing = item .offers_v2 .listings [0 ]
125125 self .assertIsNotNone (listing )
126126
127+ def test_offers_v2_listing_has_price_info (self ) -> None :
128+ """Test that OffersV2 listings include price information."""
129+ item = self .item_with_offers
130+ self .assertIsNotNone (item .offers_v2 )
131+
132+ if item .offers_v2 .listings :
133+ listing = item .offers_v2 .listings [0 ]
134+ self .assertIsNotNone (listing .price )
135+
136+ if listing .price and listing .price .money :
137+ self .assertIsNotNone (listing .price .money .amount )
138+ self .assertIsNotNone (listing .price .money .currency )
139+ self .assertIsNotNone (listing .price .money .display_amount )
140+
141+ def test_offers_v2_listing_has_merchant_info (self ) -> None :
142+ """Test that OffersV2 listings include merchant information."""
143+ item = self .item_with_offers
144+ self .assertIsNotNone (item .offers_v2 )
145+
146+ if item .offers_v2 .listings :
147+ listing = item .offers_v2 .listings [0 ]
148+
149+ if listing .merchant_info :
150+ self .assertIsNotNone (listing .merchant_info .name )
151+
152+ def test_offers_v2_listing_has_condition (self ) -> None :
153+ """Test that OffersV2 listings include condition information."""
154+ item = self .item_with_offers
155+ self .assertIsNotNone (item .offers_v2 )
156+
157+ if item .offers_v2 .listings :
158+ listing = item .offers_v2 .listings [0 ]
159+
160+ if listing .condition :
161+ self .assertIsNotNone (listing .condition .value )
162+
163+ def test_offers_v2_listing_has_availability (self ) -> None :
164+ """Test that OffersV2 listings include availability information."""
165+ item = self .item_with_offers
166+ self .assertIsNotNone (item .offers_v2 )
167+
168+ if item .offers_v2 .listings :
169+ listing = item .offers_v2 .listings [0 ]
170+
171+ if listing .availability :
172+ self .assertIsNotNone (listing .availability .type )
173+
127174 def test_get_items_returns_single_result (self ) -> None :
128175 """Test that get_items returns exactly one item when given one ASIN."""
129176 self .assertEqual (1 , len (self .get_items_result ))
@@ -133,14 +180,18 @@ def test_get_items_includes_affiliate_tag(self) -> None:
133180 self .assertIn (self .affiliate_tag , self .get_items_result [0 ].detail_page_url )
134181
135182 def test_get_items_returns_offers_v2 (self ) -> None :
136- """Test that get_items returns OffersV2 data."""
183+ """Test that get_items returns OffersV2 data with price details ."""
137184 item = self .get_items_result [0 ]
138185 self .assertIsNotNone (item .offers_v2 )
139186
140187 if item .offers_v2 .listings :
141188 listing = item .offers_v2 .listings [0 ]
142189 self .assertIsNotNone (listing )
143190
191+ if listing .price and listing .price .money :
192+ self .assertIsNotNone (listing .price .money .amount )
193+ self .assertIsNotNone (listing .price .money .display_amount )
194+
144195 def test_get_variations_returns_items (self ) -> None :
145196 """Test that get_variations returns a list of variation items."""
146197 self .assertIsNotNone (self .variations_result )
@@ -165,3 +216,81 @@ def test_get_browse_nodes_returns_node_info(self) -> None:
165216 node = self .browse_nodes_result [0 ]
166217 self .assertIsNotNone (node .id )
167218 self .assertIsNotNone (node .display_name )
219+
220+ def test_offers_v2_listing_has_is_buy_box_winner (self ) -> None :
221+ """Test that OffersV2 listings include is_buy_box_winner attribute."""
222+ item = self .item_with_offers
223+ self .assertIsNotNone (item .offers_v2 )
224+
225+ if item .offers_v2 .listings :
226+ listing = item .offers_v2 .listings [0 ]
227+ self .assertIsInstance (listing .is_buy_box_winner , bool )
228+
229+ def test_offers_v2_listing_has_type (self ) -> None :
230+ """Test that OffersV2 listings include offer type."""
231+ item = self .item_with_offers
232+ self .assertIsNotNone (item .offers_v2 )
233+
234+ if item .offers_v2 .listings :
235+ listing = item .offers_v2 .listings [0 ]
236+ if listing .type :
237+ self .assertIsNotNone (listing .type )
238+
239+ def test_offers_v2_price_has_savings_when_available (self ) -> None :
240+ """Test that OffersV2 price includes savings info when available."""
241+ item = self .item_with_offers
242+ self .assertIsNotNone (item .offers_v2 )
243+
244+ if item .offers_v2 .listings :
245+ listing = item .offers_v2 .listings [0 ]
246+ if listing .price and listing .price .savings :
247+ savings = listing .price .savings
248+ if savings .money :
249+ self .assertIsNotNone (savings .money .amount )
250+ if savings .percentage is not None :
251+ self .assertIsInstance (savings .percentage , (int , float ))
252+
253+ def test_search_items_returns_item_info (self ) -> None :
254+ """Test that search results include item info with title."""
255+ item = self .search_result .items [0 ]
256+ self .assertIsNotNone (item .item_info )
257+ self .assertIsNotNone (item .item_info .title )
258+ self .assertIsNotNone (item .item_info .title .display_value )
259+ self .assertIsInstance (item .item_info .title .display_value , str )
260+ self .assertGreater (len (item .item_info .title .display_value ), 0 )
261+
262+ def test_search_items_returns_valid_asin (self ) -> None :
263+ """Test that search results return valid ASIN format."""
264+ item = self .search_result .items [0 ]
265+ self .assertIsNotNone (item .asin )
266+ self .assertEqual (len (item .asin ), 10 )
267+ self .assertTrue (item .asin .isalnum ())
268+
269+ def test_search_items_returns_images (self ) -> None :
270+ """Test that search results include product images."""
271+ item = self .search_result .items [0 ]
272+ self .assertIsNotNone (item .images )
273+ if item .images .primary :
274+ self .assertIsNotNone (item .images .primary .large )
275+ if item .images .primary .large :
276+ self .assertIsNotNone (item .images .primary .large .url )
277+ self .assertTrue (item .images .primary .large .url .startswith ("http" ))
278+
279+ def test_get_items_returns_item_info (self ) -> None :
280+ """Test that get_items returns item info with title."""
281+ item = self .get_items_result [0 ]
282+ self .assertIsNotNone (item .item_info )
283+ self .assertIsNotNone (item .item_info .title )
284+ self .assertIsNotNone (item .item_info .title .display_value )
285+
286+ def test_get_variations_returns_offers_v2 (self ) -> None :
287+ """Test that get_variations returns OffersV2 data for variation items."""
288+ item_with_offers = next (
289+ (item for item in self .variations_result .items if item .offers_v2 ),
290+ None ,
291+ )
292+ if item_with_offers and item_with_offers .offers_v2 :
293+ self .assertIsNotNone (item_with_offers .offers_v2 )
294+ if item_with_offers .offers_v2 .listings :
295+ listing = item_with_offers .offers_v2 .listings [0 ]
296+ self .assertIsNotNone (listing )
0 commit comments