def test_check_type_with_bad_inputs(required_type, good_indices, default): bad_input_list = [ 'abc', '', 5, 0, 1.2, 0.0, 3 + 2j, 0j, ['a', 2], [], (1, 2), (), { 'key': 'val' }, {}, {1, 'abc'}, set(), True, False, b'abc', b'' ] for i in sorted(good_indices, reverse=True): del bad_input_list[i] for bad_input in bad_input_list: assert si._check_type(bad_input, required_type) == default
def test_check_type_with_truthy_good_inputs(required_type, good_input): assert si._check_type(good_input, required_type) == good_input
def test_check_type_with_defaults(required_type, default_input): assert si._check_type(default_input, required_type) == default_input