def test_all(self): mod = Model() can = Country(mod, 'Eh', 'Canada') gov = ConsolidatedGovernment(can, 'GOV', 'Government') hou = Household(can, 'HH', 'Household', .5) dummy = Sector(can, 'DUM', 'Dummy') mm = MoneyMarket(can) dep = DepositMarket(can) # Need to add demand functions in household sector mod._GenerateFullSectorCodes() hou.AddVariable('DEM_MON', 'Demand for Money', '0.5 * ' + hou.GetVariableName('F')) hou.AddVariable('DEM_DEP', 'Demand for Deposits', '0.5 * ' + hou.GetVariableName('F')) mod._GenerateEquations() # Supply = Demand self.assertEqual('GOV__SUP_DEP', dep.EquationBlock['SUP_DEP'].RHS()) # Demand = Demand of two sectors self.assertEqual('HH__DEM_DEP', dep.EquationBlock['DEM_DEP'].RHS().replace(' ', '')) # At the sector level, demand = F self.assertEqual('0.5*HH__F', kill_spaces(hou.EquationBlock['DEM_MON'].RHS())) self.assertEqual('0.5*HH__F', kill_spaces(hou.EquationBlock['DEM_DEP'].RHS())) # Make sure the dummy does not have cash flows self.assertEqual('LAG_F', dummy.EquationBlock['F'].RHS()) # Household has a deposit interest cash flow self.assertIn('INTDEP', hou.EquationBlock['F'].RHS())
def test_all(self): mod = Model() can = Country(mod, 'Eh', 'Canada') gov = ConsolidatedGovernment(can, 'GOV', 'Government') hou = Household(can, 'HH', 'Household', .5) hou2 = Household(can, 'HH2', 'Household2', .5) mm = MoneyMarket(can) mod._GenerateFullSectorCodes() mod._GenerateEquations() # Supply = Demand self.assertEqual('GOV__SUP_MON', mm.EquationBlock['SUP_MON'].RHS()) # Demand = Demand of two sectors self.assertEqual('HH__DEM_MON+HH2__DEM_MON', mm.EquationBlock['DEM_MON'].RHS().replace(' ', '')) # At the sector level, demand = F self.assertEqual('HH__F', hou.EquationBlock['DEM_MON'].RHS()) self.assertEqual('HH2__F', hou2.EquationBlock['DEM_MON'].RHS())