def test_from_yml_rep_low_probability(self):
     MapEnemyGroupTableEntry.from_yml_rep(
         {"Event Flag": 0x345,
          "Sub-Group 1 Rate": 50,
          "Sub-Group 2 Rate": 0,
          "Sub-Group 1": {0: {"Probability": 7, "Enemy Group": 0x108}},
          "Sub-Group 2": {}},
     )
    def test_to_block(self):
        for test_case in TEST_CASES:
            block_size = MapEnemyGroupTableEntry.to_block_size(test_case["value_rep"])
            assert_equal(len(test_case["block_rep"]), block_size)

            block = Block(size=block_size)
            MapEnemyGroupTableEntry.to_block(block, 0, test_case["value_rep"])
            assert_list_equal(test_case["block_rep"], block.to_list())
    def test_to_block(self):
        for test_case in TEST_CASES:
            block_size = MapEnemyGroupTableEntry.to_block_size(
                test_case["value_rep"])
            assert_equal(len(test_case["block_rep"]), block_size)

            block = Block(size=block_size)
            MapEnemyGroupTableEntry.to_block(block, 0, test_case["value_rep"])
            assert_list_equal(test_case["block_rep"], block.to_list())
 def test_from_yml_rep_high_probability(self):
     MapEnemyGroupTableEntry.from_yml_rep(
         {
             "Event Flag": 0x345,
             "Sub-Group 1 Rate": 50,
             "Sub-Group 2 Rate": 0,
             "Sub-Group 1": {
                 0: {
                     "Probability": 9,
                     "Enemy Group": 0x108
                 }
             },
             "Sub-Group 2": {}
         }, )
 def test_hex_labels(self):
     assert_equal(["Event Flag"],
                  MapEnemyGroupTableEntry.yml_rep_hex_labels())
 def test_from_yml_rep(self):
     for test_case in TEST_CASES:
         value_rep = MapEnemyGroupTableEntry.from_yml_rep(
             test_case["yml_rep"])
         assert_tuple_equal(test_case["value_rep"], value_rep)
 def test_to_yml_rep(self):
     for test_case in TEST_CASES:
         yml_rep = MapEnemyGroupTableEntry.to_yml_rep(
             test_case["value_rep"])
         assert_dict_equal(test_case["yml_rep"], yml_rep)
 def test_from_block(self):
     for test_case in TEST_CASES:
         block = Block()
         block.from_list(test_case["block_rep"])
         value = MapEnemyGroupTableEntry.from_block(block, 0)
         assert_tuple_equal(test_case["value_rep"], value)
 def test_from_yml_rep(self):
     for test_case in TEST_CASES:
         value_rep = MapEnemyGroupTableEntry.from_yml_rep(test_case["yml_rep"])
         assert_tuple_equal(test_case["value_rep"], value_rep)
 def test_to_yml_rep(self):
     for test_case in TEST_CASES:
         yml_rep = MapEnemyGroupTableEntry.to_yml_rep(test_case["value_rep"])
         assert_dict_equal(test_case["yml_rep"], yml_rep)
 def test_from_block(self):
     for test_case in TEST_CASES:
         block = Block()
         block.from_list(test_case["block_rep"])
         value = MapEnemyGroupTableEntry.from_block(block, 0)
         assert_tuple_equal(test_case["value_rep"], value)
 def test_hex_labels(self):
     assert_equal(["Event Flag"], MapEnemyGroupTableEntry.yml_rep_hex_labels())