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_is_float__default_set__valid_value(): spec = IsFloat(default=3.14) assert_equal(spec.default, 3.14)
def test_is_float__default_not_set(): spec = IsFloat() assert_is(spec.default, DEFAULT_NOT_SET)
def test_is_float__custom_description(): custom_desc = "a floaty, float" spec = IsFloat(description=custom_desc) assert_equal(spec.description, custom_desc)
def test_is_float__default_description(): spec = IsFloat() assert_equal(spec.description, "a float")
def _reject_not_str(value): spec = IsFloat() assert_raises(MakefileError, spec, _DUMMY_PATH, value)
def test_is_float__accepts_float(): spec = IsFloat() spec(_DUMMY_PATH, 1.0)
_VALID_BED_NAME = _VALID_TARGET_NAME = \ And(_alphanum_check(whitelist=".-"), ValueGE(2, key=len, description="at least two characters long")) _VALIDATION_OPTIONS = { "BamPath": IsStr, "--MinMappingQuality": IsUnsignedInt(default=25), "--MinAlignmentLength": IsUnsignedInt(default=25), "--NoReadsChecked": IsUnsignedInt(default=5000) } _VALIDATION_GCCORRECT = { "Enabled": IsBoolean(default=False), "--NoRegions": Or(IsUnsignedInt, IsStr, default=200), "--ChromUsed": Or(IsStr, IsUnsignedInt, default="all"), ## the is new "--MappaUniqueness": IsFloat(default=0.9) } _VALIDATION_NUCLEO = { "Enabled": IsBoolean(default=False), "Apply_GC_Correction": IsBoolean(default=True), "ExcludeBed": EXCLUDEBED, "--NucleosomeFlanks": IsUnsignedInt(default=25), "--NucleosomeSize": IsUnsignedInt(default=147), "--NucleosomeOffset": IsUnsignedInt(default=12) } _VALIDATION_METHYL = { "Enabled": IsBoolean(default=False), "ExcludeBed": EXCLUDEBED, "--ReadBases": IsUnsignedInt(default=15), "--MinBaseQuality": IsUnsignedInt(default=20),