def test_get_csv_header(self):
        header = AestheticSettings.get_csv_header()

        expected_header = [
            "level_space_aesthetic.noise_empty_percentage",
            "level_space_aesthetic.noise_percentage",
            "level_space_aesthetic.rectangle_count",
            "level_space_aesthetic.rectangle_max",
            "level_space_aesthetic.rectangle_min",
            "level_space_aesthetic.x_mirror_probability",
            "level_space_aesthetic.y_mirror_probability",
            "mission_aesthetic.hazard_spread_probability",
            "mission_aesthetic.max_seconds_per_move",
            "mission_aesthetic.min_seconds_per_move",
            "mission_aesthetic.single_lock_is_hazard_probability",
            "mission_graph_aesthetic.branch_probability",
            "mission_graph_aesthetic.collectable_in_room_probability",
            "mission_graph_aesthetic.insert_room_probability",
            "mission_graph_aesthetic.key_is_sokoban_probability",
            "mission_graph_aesthetic.max_depth",
            "mission_graph_aesthetic.max_locks_per_multi_lock",
            "mission_graph_aesthetic.max_multi_lock_count",
            "mission_graph_aesthetic.min_depth",
            "tweaker_aesthetic.should_fill_unused_space"
        ]

        self.assertEqual(header, expected_header)
Beispiel #2
0
    def __init__(self, file):
        # Open the csv file
        self.file = file
        self.file_data = ''
        self.header = Ratings.CSV_SEPARATOR.join(
            ["id", "seed"] + AestheticSettings.get_csv_header() +
            ["brandon_rating", "ryan_rating"]) + "\n"

        open(file, 'a').close()  # Create a file if it doesn't exist.

        with open(file, 'r') as csvfile:
            csv_reader = csv.reader(csvfile, delimiter=Ratings.CSV_SEPARATOR)
            for i, row in enumerate(csv_reader):
                if i == 0:
                    continue
                self.file_data += Ratings.CSV_SEPARATOR.join(row) + "\n"