コード例 #1
0
    def test_scenario2(self):
        """
            Scenario: Successfully building a new sample from a dataset
                Given I create a BigML dataset from "<data>" and store logs in "<output_dir>"
                And I check that the source has been created
                And I check that the dataset has been created
                Then I create a new sample from the dataset and get the sample using options "<sample_options>" storing logs in "<output_dir>"
                And I check that the sample has been created
                And the sample JSON is like the one in "<sample_JSON_file>"

                Examples:
                |data |output_dir  |sample_options | sample_JSON
                |../data/iris.csv | ./scenario_smp_4 | --stat-field "petal length"| ./check_files/stat_info.json
        """
        print self.test_scenario2.__doc__
        examples = [
            ['data/iris.csv', 'scenario_smp_4', '--stat-field "petal length"', 'check_files/stat_info.json']]
        for example in examples:
            print "\nTesting with:\n", example
            dataset.i_create_dataset(self, data=example[0], output_dir=example[1])
            test_pred.i_check_create_source(self)
            test_pred.i_check_create_dataset(self)
            test_sample.i_create_sample(self, options=example[2], output_dir=example[1])
            test_sample.i_check_create_sample(self)
            test_sample.i_check_sample_json(self, check_sample_file=example[3])
コード例 #2
0
    def test_scenario1(self):
        """
            Scenario: Successfully building a new sample from a dataset
                Given I create a BigML dataset from "<data>" and store logs in "<output_dir>"
                And I check that the source has been created
                And I check that the dataset has been created
                Then I create a new sample from the dataset and get the sample using options "<sample_options>" storing logs in "<output_dir>"
                And I check that the sample has been created
                And the sample file is like "<sample_CSV>"

                Examples:
                |data |output_dir  |sample_options | sample_CSV
                |../data/iris.csv | ./scenario_smp_1 | --occurrence --sample-header --row-index | ./check_files/sample_iris.csv
                |../data/iris.csv | ./scenario_smp_2 | --precision 0 --rows 10 --row-offset 10 --unique | ./check_files/sample_iris2.csv
                |../data/iris.csv | ./scenario_smp_3 | --row-order-by="-petal length" --row-fields "petal length,petal width" --mode linear | ./check_files/sample_iris3.csv
        """
        print self.test_scenario1.__doc__
        examples = [
            ['data/iris.csv', 'scenario_smp_1', '--occurrence --sample-header --row-index', 'check_files/sample_iris.csv'],
            ['data/iris.csv', 'scenario_smp_2', '--precision 0 --rows 10 --row-offset 10 --unique', 'check_files/sample_iris2.csv'],
            ['data/iris.csv', 'scenario_smp_3', '--row-order-by="-petal length" --row-fields "petal length,petal width" --mode linear', 'check_files/sample_iris3.csv']]
        for example in examples:
            print "\nTesting with:\n", example
            dataset.i_create_dataset(self, data=example[0], output_dir=example[1])
            test_pred.i_check_create_source(self)
            test_pred.i_check_create_dataset(self)
            test_sample.i_create_sample(self, options=example[2], output_dir=example[1])
            test_sample.i_check_create_sample(self)
            test_sample.i_check_sample_file(self, check_sample_file=example[3])
コード例 #3
0
    def test_scenario2(self):
        """
            Scenario: Successfully building a new sample from a dataset
                Given I create a BigML dataset from "<data>" and store logs in "<output_dir>"
                And I check that the source has been created
                And I check that the dataset has been created
                Then I create a new sample from the dataset and get the sample using options "<sample_options>" storing logs in "<output_dir>"
                And I check that the sample has been created
                And the sample JSON is like the one in "<sample_JSON_file>"

                Examples:
                |data |output_dir  |sample_options | sample_JSON
                |../data/iris.csv | ./scenario_smp_4 | --stat-field "petal length"| ./check_files/stat_info.json
        """
        print self.test_scenario2.__doc__
        examples = [[
            'data/iris.csv', 'scenario_smp_4', '--stat-field "petal length"',
            'check_files/stat_info.json'
        ]]
        for example in examples:
            print "\nTesting with:\n", example
            dataset.i_create_dataset(self,
                                     data=example[0],
                                     output_dir=example[1])
            test_pred.i_check_create_source(self)
            test_pred.i_check_create_dataset(self)
            test_sample.i_create_sample(self,
                                        options=example[2],
                                        output_dir=example[1])
            test_sample.i_check_create_sample(self)
            test_sample.i_check_sample_json(self, check_sample_file=example[3])
コード例 #4
0
    def test_scenario1(self):
        """
            Scenario: Successfully building a new sample from a dataset
                Given I create a BigML dataset from "<data>" and store logs in "<output_dir>"
                And I check that the source has been created
                And I check that the dataset has been created
                Then I create a new sample from the dataset and get the sample using options "<sample_options>" storing logs in "<output_dir>"
                And I check that the sample has been created
                And the sample file is like "<sample_CSV>"

                Examples:
                |data |output_dir  |sample_options | sample_CSV
                |../data/iris.csv | ./scenario_smp_1 | --occurrence --sample-header --row-index | ./check_files/sample_iris.csv
                |../data/iris.csv | ./scenario_smp_2 | --precision 0 --rows 10 --row-offset 10 --unique | ./check_files/sample_iris2.csv
                |../data/iris.csv | ./scenario_smp_3 | --row-order-by="-petal length" --row-fields "petal length,petal width" --mode linear | ./check_files/sample_iris3.csv
        """
        print self.test_scenario1.__doc__
        examples = [
            [
                'data/iris.csv', 'scenario_smp_1',
                '--occurrence --sample-header --row-index',
                'check_files/sample_iris.csv'
            ],
            [
                'data/iris.csv', 'scenario_smp_2',
                '--precision 0 --rows 10 --row-offset 10 --unique',
                'check_files/sample_iris2.csv'
            ],
            [
                'data/iris.csv', 'scenario_smp_3',
                '--row-order-by="-petal length" --row-fields "petal length,petal width" --mode linear',
                'check_files/sample_iris3.csv'
            ]
        ]
        for example in examples:
            print "\nTesting with:\n", example
            dataset.i_create_dataset(self,
                                     data=example[0],
                                     output_dir=example[1])
            test_pred.i_check_create_source(self)
            test_pred.i_check_create_dataset(self)
            test_sample.i_create_sample(self,
                                        options=example[2],
                                        output_dir=example[1])
            test_sample.i_check_create_sample(self)
            test_sample.i_check_sample_file(self, check_sample_file=example[3])