def test_nature_to_traders(self): header("Testing nature_to_traders") exec_key = create_exec_env() self.goods = natures_goods self.traders = {} self.traders["trader0"] = create_trader("trader", 0, exec_key=exec_key) self.traders["trader1"] = create_trader("trader", 1, exec_key=exec_key) mn.nature_to_traders(self.traders, self.goods) # goods are depleted because of empty dicts self.assertEqual(self.traders["trader0"][GOODS], {}) self.assertEqual(self.traders["trader1"][GOODS], {})
def test_create_trader(self): # header("Testing create_trader") exec_key = create_exec_env() self.trader = create_trader("trader", 0, exec_key=exec_key) self.assertTrue(isinstance(self.trader.name, str)) self.assertTrue(isinstance(self.trader[GOODS], dict)) self.assertEqual(self.trader["util"], 0)
def test_nature_to_traders(self): self.trader[0] = mn.create_trader('Trader', 0) self.trader[1] = mn.create_trader('Trader', 1) mn.nature_to_traders(self.trader, self.goods) self.assertNotEqual(self.trader[0]["goods"], {}) self.assertNotEqual(self.trader[1]["goods"], {})
def test_create_trader(self): self.trader[0] = mn.create_trader('Trader', 0) self.assertEqual(self.trader[0].name, "Trader0") self.assertEqual(self.trader[0][GOODS], {}) self.assertEqual(self.trader[0]["util"], 0)