예제 #1
0
    def test_parse_header(self):
        config._parse_header(self.csv_reader, self.config)

        # check index of x
        input_node = self.config["input_variables"][0]
        self.assertEquals(input_node["data_index"], 0)

        # check index of y
        response_var = self.config["response_variables"][0]
        self.assertEquals(response_var["data_index"], 1)
예제 #2
0
    def test_parse_header(self):
        config._parse_header(self.csv_reader, self.config)

        # check index of x
        input_node = self.config["input_variables"][0]
        self.assertEquals(input_node["data_index"], 0)

        # check index of y
        response_var = self.config["response_variables"][0]
        self.assertEquals(response_var["data_index"], 1)
예제 #3
0
    def test_parse_data_row(self):
        config._parse_header(self.csv_reader, self.config)

        row = [0, 100]
        self.config["data"] = []
        variables = []
        variables.append(self.config["response_variables"][0])
        variables.extend(self.config["input_variables"])

        # create data and variables (i.e. a data table in list form)
        self.config["data"] = {}
        for var in variables:
            self.config["data"][str(var["name"])] = []

        config._parse_data_row(row, self.config, variables)

        # assert x and y
        self.assertEquals(self.config["data"]["x"][0], 0)
        self.assertEquals(self.config["data"]["y"][0], 100)
예제 #4
0
    def test_parse_data_row(self):
        config._parse_header(self.csv_reader, self.config)

        row = [0, 100]
        self.config["data"] = []
        variables = []
        variables.append(self.config["response_variables"][0])
        variables.extend(self.config["input_variables"])

        # create data and variables (i.e. a data table in list form)
        self.config["data"] = {}
        for var in variables:
            self.config["data"][str(var["name"])] = []

        config._parse_data_row(row, self.config, variables)

        # assert x and y
        self.assertEquals(self.config["data"]["x"][0], 0)
        self.assertEquals(self.config["data"]["y"][0], 100)
예제 #5
0
 def test_parse_data(self):
     config._parse_header(self.csv_reader, self.config)
     config._parse_data(self.csv_reader, self.config)
     self.config["data"].pop("rows")
     self.assertEquals(self.config["data"], self.solution)
예제 #6
0
 def test_parse_data(self):
     config._parse_header(self.csv_reader, self.config)
     config._parse_data(self.csv_reader, self.config)
     self.config["data"].pop("rows")
     self.assertEquals(self.config["data"], self.solution)