349 def test_wrapper_triggers_deprecation_warning(self):
350 """Passing a GncPrice wrapper to gnucash_core_c should emit
351 DeprecationWarning and still return a valid result."""
352 from gnucash import gnucash_core_c as gc
353
354 price = self.pricedb.lookup_latest(self.test_comm, self.usd)
355 if price is None:
356 self.skipTest("No price data")
357
358 self.assertIsInstance(price, GncPrice)
359
360 with warnings.catch_warnings(record=True) as w:
361 warnings.simplefilter("always")
362
363 comm_instance = gc.gnc_price_get_commodity(price)
364 dep_warnings = [x for x in w
365 if issubclass(x.category, DeprecationWarning)]
366 self.assertGreater(len(dep_warnings), 0,
367 "Expected DeprecationWarning from typemap")
368