def test_specs__path_is_displayed_in_exception(): def _path_is_displayed_in_exception(spec, value): assert_raises_regexp(MakefileError, _DUMMY_PATH_STR, spec, _DUMMY_PATH, value) yield _path_is_displayed_in_exception, IsInt(), "foo" yield _path_is_displayed_in_exception, IsUnsignedInt(), -1 yield _path_is_displayed_in_exception, IsFloat(), "abc" yield _path_is_displayed_in_exception, IsBoolean(), 1 yield _path_is_displayed_in_exception, IsStr(), 1 yield _path_is_displayed_in_exception, IsNone(), 1 yield _path_is_displayed_in_exception, ValueLT(0), 1 yield _path_is_displayed_in_exception, ValueLE(0), 1 yield _path_is_displayed_in_exception, ValueGE(0), -1 yield _path_is_displayed_in_exception, ValueGT(0), -1 yield _path_is_displayed_in_exception, ValueIn([1]), 2 yield _path_is_displayed_in_exception, ValuesIntersect([1]), [2] yield _path_is_displayed_in_exception, ValuesSubsetOf([1]), [2] yield _path_is_displayed_in_exception, ValueMissing(), True yield _path_is_displayed_in_exception, And(IsStr), 1 yield _path_is_displayed_in_exception, Or(IsStr), 1 yield _path_is_displayed_in_exception, Xor(IsStr, IsInt), True yield _path_is_displayed_in_exception, Not(IsInt), 1 yield _path_is_displayed_in_exception, StringIn("abc"), 1 yield _path_is_displayed_in_exception, StringsIntersect("abc"), [1] yield _path_is_displayed_in_exception, StringsSubsetOf("abc"), [1] yield _path_is_displayed_in_exception, StringIsUppercase(), 1 yield _path_is_displayed_in_exception, StringStartsWith("FOO"), 1 yield _path_is_displayed_in_exception, StringEndsWith("FOO"), 1 yield _path_is_displayed_in_exception, IsListOf(IsInt), "foo" yield _path_is_displayed_in_exception, IsDictOf(IsInt, IsInt), 1
def test_strings_subset_of__default_set__valid_value(): spec = StringsSubsetOf("ABCDEFGH", default="adFg") assert_equal(spec.default, "adFg")
def test_strings_subset_of__default_not_set(): spec = StringsSubsetOf("ABCDEFGH") assert_is(spec.default, DEFAULT_NOT_SET)
def test_strings_subset_of__rejects_dictionary(): spec = StringsSubsetOf("abc") assert_raises(MakefileError, spec, _DUMMY_PATH, {"a": 1, "b": 2})
def test_subset_of__case_insensitive__mixed_string_string_found(): spec = StringsSubsetOf(("A", "c", "B", 1, 2, 3)) spec(_DUMMY_PATH, "a")
def test_subset_of__chars__case_insensitive__accepts_differences_in_case(): spec = StringsSubsetOf("abcdefghijkl ") spec(_DUMMY_PATH, "A big DEAL")
def test_subset_of__case_insensitive__value_in_set(): spec = StringsSubsetOf(("Abc", "bCe", "cdE")) spec(_DUMMY_PATH, ["Bce"])