def test_experiments_function_additions(): with experiment_testing_context(): for rec in my_xxxyyy_test_experiment.get_variant_records(flat=True): rec.delete() r1=my_xxxyyy_test_experiment.run() r2=my_xxxyyy_test_experiment.get_variant('a2').run() with pytest.raises(Exception): my_xxxyyy_test_experiment.get_variant(b=17).run() r3 = my_xxxyyy_test_experiment.get_variant(b=17).get_latest_record() assert r1.get_log() == 'xxx\n' assert r2.get_log() == 'yyy\n' assert get_oneline_result_string(my_xxxyyy_test_experiment.get_latest_record()) == '3bbb' assert get_oneline_result_string(my_xxxyyy_test_experiment.get_variant('a2').get_latest_record()) == '4bbb' assert get_oneline_result_string(my_xxxyyy_test_experiment.get_variant(b=17).get_latest_record()) == '<No result has been saved>' with CaptureStdOut() as cap: my_xxxyyy_test_experiment.show(my_xxxyyy_test_experiment.get_latest_record()) assert cap.read() == '3aaa\n' with CaptureStdOut() as cap: my_xxxyyy_test_experiment.compare([r1, r2]) assert cap.read() == 'my_xxxyyy_test_experiment: 3, my_xxxyyy_test_experiment.a2: 4\n' print('='*100+'\n ARGTABLE \n'+'='*100) print_experiment_record_argtable([r1, r2, r3]) print('='*100+'\n SHOW \n'+'='*100) compare_experiment_records([r1, r2, r3])
def argtable(self, *args): parser = argparse.ArgumentParser() parser.add_argument('user_range', action='store', nargs = '?', default='all', help='A selection of experiment records to run. Examples: "3" or "3-5", or "3,4,5"') args = parser.parse_args(args) records = select_experiment_records(args.user_range, self.exp_record_dict, flat=True) print_experiment_record_argtable(records) _warn_with_prompt(use_prompt=False)
def argtable(self, *args): parser = argparse.ArgumentParser() parser.add_argument('user_range', action='store', nargs = '?', default='all', help='A selection of experiment records to run. Examples: "3" or "3-5", or "3,4,5"') args = parser.parse_args(args) records = select_experiment_records(args.user_range, self.exp_record_dict, flat=True) print_experiment_record_argtable(records) _warn_with_prompt(use_prompt=False)
def compare(self, user_range): identifiers = self._select_records(user_range) print_experiment_record_argtable(identifiers) _warn_with_prompt('')
def argtable(self, user_range): records = select_experiment_records(user_range, self.exp_record_dict, flat=True) print_experiment_record_argtable(records) _warn_with_prompt(use_prompt=not self.close_after)
def compare(self, user_range): identifiers = self._select_records(user_range) print_experiment_record_argtable(identifiers) _warn_with_prompt('')