def initialize_options(
        options: Optional[Options], reporter: Optional[Reporter] = None
) -> Options:
    if options is None:
        options = Options()
    if reporter is not None:
        options = options.with_reporter(reporter)
    return options
def test_with_reporter():
    testr = ReporterForTesting()
    options = Options().with_reporter(testr)
    try:
        verify("Data2", options=options)
    except:
        pass

    assert testr.called
Beispiel #3
0
 def with_parameters(*args: Any) -> Options:
     from approvaltests.core.scenario_namer import ScenarioNamer
     namer = ScenarioNamer(get_default_namer(), *args)
     return Options().with_namer(namer)
def test_file_extensions():
    content = "# This is a markdown header\n"
    # begin-snippet: options_with_file_extension
    verify(content, options=Options().for_file.with_extension(".md"))
    # end-snippet
    verify(content, options=Options().for_file.with_extension("md"))
def test_setting_reporter():
    testr = ReporterForTesting()
    options = Options().with_reporter(testr)
    assert options.reporter == testr
def test_empty_options_has_default_reporter():
    ##approvals.set_default_reporter(None)
    options = Options()
    assert options.reporter == get_default_reporter()