def test_parses_basedir_with_run(self):

        path = pathlib.Path('ai-upsample-peaks-fcrn_a_wide-run003')

        res = utils.parse_training_dir(path)

        exp = {'detector': 'fcrn_a_wide',
               'run': 3,
               'num_iters': None,
               'training_set': 'peaks'}
        self.assertEqual(res, exp)
    def test_parses_iterdir_with_run_different_set(self):

        path = pathlib.Path('ai-upsample-confocal-fcrn_a_wide-run003/ai-upsample-confocal-n75000')

        res = utils.parse_training_dir(path)

        exp = {'detector': 'fcrn_a_wide',
               'run': 3,
               'num_iters': 75000,
               'training_set': 'confocal'}
        self.assertEqual(res, exp)
    def test_parses_basedir_no_run(self):

        path = pathlib.Path('ai-upsample-peaks-composite-d3-opt')

        res = utils.parse_training_dir(path)

        exp = {'detector': 'composite-d3-opt',
               'run': None,
               'num_iters': None,
               'training_set': 'peaks'}
        self.assertEqual(res, exp)
    def test_errors_on_iterdir_rundir_mismatch(self):

        path = pathlib.Path('ai-upsample-confocal-fcrn_a_wide-run003/ai-upsample-peaks-n75000')

        with self.assertRaises(KeyError):
            utils.parse_training_dir(path)