def testCustomField(self): msg = f"INFO:yt:Loading plugins from {self.plugin_path}" with self.assertLogs("yt", level="INFO") as cm: yt.enable_plugins() self.assertEqual(cm.output, [msg]) ds = fake_random_ds(16) dd = ds.all_data() self.assertEqual(str(dd[("gas", "random")].units), "dimensionless") self.assertEqual(dd[("gas", "random")].shape, dd[("gas", "density")].shape) assert yt.myfunc() == 12 assert_raises(AttributeError, getattr, yt, "foobar")
def testCustomField(self): plugin_file = os.path.join(CONFIG_DIR, ytcfg.get("yt", "plugin_filename")) msg = f"INFO:yt:Loading plugins from {plugin_file}" with self.assertLogs("yt", level="INFO") as cm: yt.enable_plugins() self.assertEqual(cm.output, [msg]) ds = fake_random_ds(16) dd = ds.all_data() self.assertEqual(str(dd["random"].units), "dimensionless") self.assertEqual(dd["random"].shape, dd["density"].shape) assert yt.myfunc() == 12 assert_raises(AttributeError, getattr, yt, "foobar")
def testCustomField(self): plugin_file = os.path.join(CONFIG_DIR, ytcfg.get('yt', 'pluginfilename')) msg = 'INFO:yt:Loading plugins from %s' % plugin_file if sys.version_info >= (3, 4, 0): with self.assertLogs('yt', level='INFO') as cm: yt.enable_plugins() self.assertEqual(cm.output, [msg]) else: yt.enable_plugins() ds = fake_random_ds(16) dd = ds.all_data() self.assertEqual(str(dd['random'].units), 'dimensionless') self.assertEqual(dd['random'].shape, dd['density'].shape) assert yt.myfunc() == 4 assert_raises(AttributeError, getattr, yt, 'foobar')