def test_experiment_function_ui():

    with experiment_testing_context():
        for existing_record in my_xxxyyy_test_experiment.get_variant_records(flat=True):
            existing_record.delete()

        assert len(my_xxxyyy_test_experiment.get_variant_records(flat=True)) == 0

        my_xxxyyy_test_experiment.browse(raise_display_errors=True, command='run all', close_after=True)
        assert len(my_xxxyyy_test_experiment.get_variant_records()) == 3

        import time
        time.sleep(0.1)

        with assert_things_are_printed(min_len=1200, things=['Common Args', 'Different Args', 'Result', 'a=1, b=2', 'a=2, b=2', 'a=1, b=17']):
            my_xxxyyy_test_experiment.browse(raise_display_errors=True, command='argtable all', close_after=True)

        with assert_things_are_printed(min_len=600, things=['my_xxxyyy_test_experiment: 3', 'my_xxxyyy_test_experiment.a2: 4']):
            my_xxxyyy_test_experiment.browse(raise_display_errors=True, command='compare all -r', close_after=True)

        with assert_things_are_printed(min_len=1300, things=['Result', 'Logs', 'Ran Succesfully', 'Traceback']):
            my_xxxyyy_test_experiment.browse(raise_display_errors=True, command='show all -o', close_after=True)

        with assert_things_are_printed(min_len=1250, things=['3aaa', '4aaa']):
            my_xxxyyy_test_experiment.browse(raise_display_errors=True, command='show all -r', close_after=True)

        with assert_things_are_printed(min_len=1700, things=['Result', 'Logs', 'Ran Succesfully']):
            my_xxxyyy_test_experiment.browse(raise_display_errors=True, command='show 0 -o', close_after=True)
def test_simple_experiment_show():

    with experiment_testing_context(new_experiment_lib=True):

        @experiment_function
        def my_simdfsfdsgfs(a=1):

            print('xxxxx')
            print('yyyyy')
            return a+2

        rec = my_simdfsfdsgfs.run()

        with assert_things_are_printed(things=['my_simdfsfdsgfs', 'xxxxx\nyyyyy\n']):
            compare_experiment_records(rec)