Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)