Exemple #1
0
def contents_raises_hard_error__including_ext_deps(
) -> Assertion[StringSourceContents]:
    return asrt.and_([
        asrt.named(
            'may_have_external_dependencies',
            ext_dependencies_raises_hard_error(),
        ),
        actual_contents(
            asrt.and_([
                asrt.named(contents_case.name,
                           RaisesHardErrorAsLastAction(contents_case.value))
                for contents_case in
                properties_access.ALL_CASES__WO_LINES_ITER_CHECK
            ]), ),
    ])
Exemple #2
0
def actual_contents(
    expectation: Assertion[StringSourceContents]
) -> Assertion[StringSourceContents]:
    return asrt.named(
        'actual contents',
        expectation,
    )
Exemple #3
0
def pre_post_freeze(before_freeze: Assertion[StringSourceContents],
                    after_freeze: Assertion[StringSourceContents],
                    ) -> Assertion[StringSource]:
    return asrt.and_([
        has_valid_structure_description(),
        asrt.named(
            'pre freeze',
            contents_matches(before_freeze),
        ),
        asrt.named(
            'post freeze',
            asrt.after_manipulation(
                _freeze_string_source,
                contents_matches(after_freeze),
            ),
        ),
    ])
def matches_w_application_order(
    files_and_results: Mapping[PurePosixPath,
                               Assertion[Optional[FileMatcher]]],
    application_sequence: Sequence[Tuple[
        ConstantMatcherThatRegistersApplication, List[int]]],
) -> Assertion[FilesCondition]:
    return asrt.and_([
        asrt_primitive.files_matches(files_and_results),
        asrt.named('application order',
                   MatcherApplicationSequenceAssertion(application_sequence))
    ])
Exemple #5
0
def contents_raises_hard_error(
    may_depend_on_external_resources: Assertion[bool],
) -> Assertion[StringSourceContents]:
    return asrt.and_([
        external_dependencies(may_depend_on_external_resources),
        actual_contents(
            asrt.and_([
                asrt.named(contents_case.name,
                           RaisesHardErrorAsLastAction(contents_case.value))
                for contents_case in
                properties_access.ALL_CASES__WO_LINES_ITER_CHECK
            ]), ),
    ])
Exemple #6
0
def contents_raises_hard_error(may_depend_on_external_resources: Assertion[bool],
                               structure: Assertion[NodeRenderer]
                               = asrt_trace_rendering.matches_node_renderer(),
                               ) -> Assertion[StringSource]:
    return asrt.and_([
        has_structure_description(structure),
        contents_matches(
            asrt.and_(
                [asrt_str_src_contents.external_dependencies(may_depend_on_external_resources)] +
                [
                    asrt.named(
                        contents_case.name,
                        RaisesHardErrorAsLastAction(
                            contents_case.value
                        )
                    )
                    for contents_case in properties_access.ALL_CASES__WO_LINES_ITER_CHECK
                ]),
        ),
    ])
Exemple #7
0
def ext_dependencies_raises_hard_error() -> Assertion[StringSourceContents]:
    return asrt.named(
        'may_depend_on_external_resources',
        RaisesHardErrorAsLastAction(
            properties_access.get_may_depend_on_external_resources),
    )