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