Esempio n. 1
0
 def test_increment_branch_scaling_ref_only(self):
     change_table = MockChangeTable(grid=mock_grid, ct=self.ct)
     expected_ct = self.ct.copy()
     expected_ct["branch"] = {"branch_id": self.orig_branch_scaling.copy()}
     self.assertNotEqual(change_table.ct, expected_ct)
     _increment_branch_scaling(change_table,
                               branch_ids=set(),
                               ref_scenario=self.ref_scenario)
     self.assertEqual(change_table.ct, expected_ct)
Esempio n. 2
0
 def test_increment_branch_scaling_ref_and_ct_and_increment2(self):
     # Our change_table branch should NOT get over-written by increment
     change_table = MockChangeTable(grid=mock_grid, ct=self.ct)
     change_table.ct["branch"] = {"branch_id": {101: 3}}
     expected_ct = change_table.ct.copy()
     expected_ct["branch"] = {"branch_id": self.orig_branch_scaling.copy()}
     expected_ct["branch"]["branch_id"][101] = 3
     self.assertNotEqual(change_table.ct, expected_ct)
     _increment_branch_scaling(change_table,
                               branch_ids={101},
                               ref_scenario=self.ref_scenario)
     self.assertEqual(change_table.ct, expected_ct)
Esempio n. 3
0
 def test_increment_branch_scaling_ref_and_increment(self):
     change_table = MockChangeTable(grid=mock_grid, ct=self.ct)
     expected_ct = self.ct.copy()
     expected_ct["branch"] = {"branch_id": self.orig_branch_scaling.copy()}
     expected_ct["branch"]["branch_id"][102] = 3.5
     expected_ct["branch"]["branch_id"][103] = 3
     expected_ct["branch"]["branch_id"][107] = 2
     self.assertNotEqual(change_table.ct, expected_ct)
     _increment_branch_scaling(change_table,
                               branch_ids={102, 103, 107},
                               ref_scenario=self.ref_scenario)
     self.assertEqual(change_table.ct, expected_ct)
Esempio n. 4
0
 def test_increment_branch_scaling_ref_and_custom_increment(self):
     change_table = MockChangeTable(grid=mock_grid, ct=self.ct)
     expected_ct = self.ct.copy()
     expected_ct["branch"] = {"branch_id": self.orig_branch_scaling.copy()}
     expected_ct["branch"]["branch_id"][101] = 2.0
     expected_ct["branch"]["branch_id"][105] = 4.5
     expected_ct["branch"]["branch_id"][106] = 1.5
     self.assertNotEqual(change_table.ct, expected_ct)
     _increment_branch_scaling(
         change_table,
         branch_ids={101, 105, 106},
         ref_scenario=self.ref_scenario,
         value=0.5,
     )
     self.assertEqual(change_table.ct, expected_ct)