Esempio n. 1
0
def matches_when_submatchers_all_match():
    matcher = any_of(
        has_attr("username", equal_to("bob")),
        has_attr("email_address", equal_to("*****@*****.**")),
    )

    assert_equal(matched(), matcher.match(User("bob", "*****@*****.**")))
def matches_when_submatchers_all_match():
    matcher = any_of(
        has_attr("username", equal_to("bob")),
        has_attr("email_address", equal_to("*****@*****.**")),
    )
    
    assert_equal(matched(), matcher.match(User("bob", "*****@*****.**")))
Esempio n. 3
0
def description_contains_descriptions_of_submatchers():
    matcher = any_of(
        has_attr("username", equal_to("bob")),
        has_attr("email_address", equal_to("*****@*****.**")),
    )

    assert_equal(
        "any of:\n * object with attribute username: '******'\n * object with attribute email_address: '*****@*****.**'",
        matcher.describe())
Esempio n. 4
0
def matches_when_any_submatchers_match():
    matcher = any_of(
        equal_to("bob"),
        equal_to("jim"),
    )

    assert_equal(
        matched(),
        matcher.match("bob"),
    )
def description_contains_descriptions_of_submatchers():
    matcher = any_of(
        has_attr("username", equal_to("bob")),
        has_attr("email_address", equal_to("*****@*****.**")),
    )
    
    assert_equal(
        "any of:\n * object with attribute username: '******'\n * object with attribute email_address: '*****@*****.**'",
        matcher.describe()
    )
def mismatches_when_no_submatchers_match():
    matcher = any_of(
        equal_to("bob"),
        equal_to("jim"),
    )
    
    assert_equal(
        unmatched("did not match any of:\n * 'bob' [was 'alice']\n * 'jim' [was 'alice']"),
        matcher.match("alice"),
    )
def matches_when_any_submatchers_match():
    matcher = any_of(
        equal_to("bob"),
        equal_to("jim"),
    )
    
    assert_equal(
        matched(),
        matcher.match("bob"),
    )
Esempio n. 8
0
def mismatches_when_no_submatchers_match():
    matcher = any_of(
        equal_to("bob"),
        equal_to("jim"),
    )

    assert_equal(
        unmatched(
            "did not match any of:\n * 'bob' [was 'alice']\n * 'jim' [was 'alice']"
        ),
        matcher.match("alice"),
    )