コード例 #1
0
    def test_finds_multiple_dirs_str(self):

        r1 = self.tempdir / 'data/Experiment/2016-01-01'
        r2 = self.tempdir / 'data/Experiment/2016-02-01'

        res = utils.find_experiment_dirs([str(r1), str(r2)])

        self.assertEqual(res, [r1, r2])
コード例 #2
0
    def test_finds_single_dir_basedir(self):

        basedir = self.tempdir / 'data/Experiment'
        r1 = basedir / '2016-01-01'
        r1.mkdir(parents=True)

        res = utils.find_experiment_dirs(basedir=basedir)

        self.assertEqual(res, [r1])
コード例 #3
0
    def test_ignores_dirs_with_weird_suffices_basedir(self):

        basedir = self.tempdir / 'data/Experiment'
        r1 = basedir / '2016-02-09-bees'
        r1.mkdir(parents=True)

        r2 = basedir / '2016-02-03'
        r2.mkdir(parents=True)

        res = utils.find_experiment_dirs(basedir=str(basedir))

        self.assertEqual(res, [r2])
コード例 #4
0
    def test_finds_multiple_dir_basedir(self):

        basedir = self.tempdir / 'data/Experiment'
        r1 = basedir / '2016-01-01'
        r1.mkdir(parents=True)

        r2 = basedir / '2016-02-03'
        r2.mkdir(parents=True)

        res = utils.find_experiment_dirs(basedir=str(basedir))

        self.assertEqual(res, [r1, r2])
コード例 #5
0
    def test_ignores_files_finds_dirs_basedir(self):

        basedir = self.tempdir / 'data/Experiment'
        r1 = basedir / '2016-01-01'
        r1.parent.mkdir(parents=True)
        with r1.open('wt') as fp:
            fp.write('bees')

        r2 = basedir / '2016-02-03'
        r2.mkdir(parents=True)

        res = utils.find_experiment_dirs(basedir=str(basedir))

        self.assertEqual(res, [r2])
コード例 #6
0
    def test_finds_single_dir_str(self):

        r1 = self.tempdir / 'data/Experiment/2016-01-01'
        res = utils.find_experiment_dirs(str(r1))

        self.assertEqual(res, [r1])
コード例 #7
0
    def test_finds_nothing_by_default(self):

        res = utils.find_experiment_dirs()
        self.assertEqual(res, [])