예제 #1
0
        exp = my_experiment

        actual_paths = []
        for case_ordered in product(*[case.vals for case in case_list]):
            actual_paths.append(os.path.join(*case_ordered))
        exp_paths = exp._walk_cases()
        for expected, actual in zip(exp_paths, actual_paths):
            print(expected, actual)
            self.assertEqual(expected, actual)

        # Generic - no format arguments
        exp = Experiment("Test Experiment",
                         case_list,
                         case_path="",
                         validate_data=False)
        for p in exp._walk_cases():
            self.assertEqual(p, "")

    def test_validate(self):
        """ Test ability for Experiment to infer whether or not data corresponding
        to this experiment actual exist at the given path. """
        pass

    def test_exp_bits(self):
        """ Test if Experiment correctly provides the bits/kwargs corresponding
        to its configuration. """
        pass

    def test_from_yaml(self):
        """ Test reading a configuration from a YAML file on disk. """
예제 #2
0
        yran = period.split('-')
    except IndexError:
        print("Damn! No - symbols exist!")
    startdate = rrow.Arrow(int(yran[0]), 1, 1)
    enddate = rrow.Arrow(int(yran[1]), 12, 31)
    Timerange = namedtuple('Timerange', 'start end range')
    timerange = Timerange(startdate, enddate,
                          rrow.Arrow.span_range('year', startdate, enddate))
    return timerange


if __name__ == "__main__":

    root = exp.data_dir

    for path, case_kws in exp._walk_cases(with_kws=True):
        full_path = os.path.join(root, path)
        try:
            os.makedirs(full_path)
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise

        # skip if scenario and historical cases don't match
        if _unmatched_args(**case_kws):
            continue
        if not case_kws['fixedperiod']:
            prefix = exp.case_prefix(**case_kws) + _build_timerange(
                case_kws['period']).start.format('YYYYMMDD') + \
                "-" + _build_timerange(
                case_kws['period']).end.format('YYYYMMDD')