예제 #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", "*****@*****.**")))
예제 #2
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())
예제 #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()
    )
예제 #4
0
def description_contains_description_of_property():
    assert_equal(
        "object with attribute username: '******'",
        has_attr("username", equal_to("bob")).describe()
    )
예제 #5
0
def submatcher_is_coerced_to_matcher():
    assert_equal(
        unmatched("attribute username was 'bobbity'"),
        has_attr("username", "bob").match(User("bobbity"))
    )
예제 #6
0
def explanation_of_mismatch_contains_mismatch_of_property():
    assert_equal(
        unmatched("attribute username was 'bobbity'"),
        has_attr("username", equal_to("bob")).match(User("bobbity"))
    )
예제 #7
0
def mismatches_when_property_is_missing():
    assert_equal(
        unmatched("was missing attribute username"),
        has_attr("username", equal_to("bob")).match("bobbity")
    )
예제 #8
0
def matches_when_property_has_correct_value():
    assert_equal(matched(), has_attr("username", equal_to("bob")).match(User("bob")))
예제 #9
0
def description_contains_description_of_property():
    assert_equal("object with attribute username: '******'",
                 has_attr("username", equal_to("bob")).describe())
예제 #10
0
def submatcher_is_coerced_to_matcher():
    assert_equal(unmatched("attribute username was 'bobbity'"),
                 has_attr("username", "bob").match(User("bobbity")))
예제 #11
0
def explanation_of_mismatch_contains_mismatch_of_property():
    assert_equal(unmatched("attribute username was 'bobbity'"),
                 has_attr("username", equal_to("bob")).match(User("bobbity")))
예제 #12
0
def mismatches_when_property_is_missing():
    assert_equal(unmatched("was missing attribute username"),
                 has_attr("username", equal_to("bob")).match("bobbity"))
예제 #13
0
def matches_when_property_has_correct_value():
    assert_equal(matched(),
                 has_attr("username", equal_to("bob")).match(User("bob")))
예제 #14
0
def test_client_can_be_created():
    client = SpellClient(spell_conn_id="testing-spell-client")
    assert_that(client, has_attr("spell_conn_id", "testing-spell-client"))