Beispiel #1
0
def test_is_in_success():
    assert_match_success(is_in([1, 2, 3]), 1, "1")
Beispiel #2
0
def test_equal_to_success():
    assert_match_success(equal_to(1), 1, "1")
Beispiel #3
0
def test_has_length_success():
    assert_match_success(has_length(3), "foo", "3")
Beispiel #4
0
def test_less_than_success():
    assert_match_success(less_than(1), 0, "0")
Beispiel #5
0
def test_is_between_success():
    assert_match_success(is_between(1, 3), 2, "2")
Beispiel #6
0
def test_is_false_success():
    assert_match_success(is_false(), False, "false")
Beispiel #7
0
def test_greater_than_success():
    assert_match_success(greater_than(1), 2, "2")
Beispiel #8
0
def test_is_integer_with_arg_success():
    assert_match_success(is_integer(1), 1, "1")
Beispiel #9
0
def test_is_bool_success():
    assert_match_success(is_bool(), True, "true")
Beispiel #10
0
def test_is_float_with_arg_success():
    assert_match_success(is_float(1.2), 1.2, "1.2")
Beispiel #11
0
def test_is_integer_success():
    assert_match_success(is_integer(), 1, "1")
Beispiel #12
0
def test_is_float_success():
    assert_match_success(is_float(), 1.2, "1.2")
Beispiel #13
0
def test_is_dict_with_argument_success():
    assert_match_success(is_dict(has_entry("foo")), {"foo": 1}, "1")
Beispiel #14
0
def test_has_item_success():
    result = assert_match_success(has_item(greater_than(2)), [1, 3], "index 1")
    assert result.index == 1
    assert result.item == 3
Beispiel #15
0
def test_is_str_with_arg_success():
    assert_match_success(is_str("foo"), "foo", "foo")
Beispiel #16
0
def test_is_bool_with_arg_success():
    assert_match_success(is_bool(True), True, "true")
Beispiel #17
0
def test_is_true_success():
    assert_match_success(is_true(), True, "true")
Beispiel #18
0
def test_is_list_success():
    assert_match_success(is_list(), [], "[]")
Beispiel #19
0
def test_not_equal_to_success():
    assert_match_success(not_equal_to(1), 2, "2")
Beispiel #20
0
def test_is_list_with_tuple_success():
    assert_match_success(is_list(), (), "[]")
Beispiel #21
0
def test_greater_than_or_equal_to_success():
    assert_match_success(greater_than_or_equal_to(1), 1, "1")
Beispiel #22
0
def test_is_list_with_arg_success():
    assert_match_success(is_list(has_length(2)), [21, 42], "2")
Beispiel #23
0
def test_less_than_or_equal_to_success():
    assert_match_success(less_than_or_equal_to(1), 1, "1")
Beispiel #24
0
def test_is_dict_success():
    assert_match_success(is_dict(), {}, "{}")
Beispiel #25
0
def test_is_none_success():
    assert_match_success(is_none(), None, "null")
Beispiel #26
0
def test_is_str_success():
    assert_match_success(is_str(), "foo", "foo")
Beispiel #27
0
def test_is_not_none_success():
    assert_match_success(is_not_none(), "foo", "foo")
Beispiel #28
0
def test_is_str_with_unicode_success():
    assert_match_success(is_str(), u"ààà", u"ààà")
Beispiel #29
0
def test_has_length_with_matcher_success():
    assert_match_success(has_length(greater_than(2)), "foo", "3")
Beispiel #30
0
def test_has_only_values_success():
    assert_match_success(has_only_values([3, 1, 2]), [1, 2, 3], "got")