Best Python code snippet using hypothesis
11456_test_inspect_args.py
Source:11456_test_inspect_args.py
...39 assert f(x=1, y=2)40 assert raises(TypeError, lambda: f(1, 2, 3))41def test_is_valid(check_valid=is_valid_args, incomplete=False):42 orig_check_valid = check_valid43 check_valid = lambda func, *args, **kwargs: orig_check_valid(func, args, kwargs)44 f = make_func('')45 assert check_valid(f)46 assert check_valid(f, 1) is False47 assert check_valid(f, x=1) is False48 f = make_func('x')49 assert check_valid(f) is incomplete50 assert check_valid(f, 1)51 assert check_valid(f, x=1)52 assert check_valid(f, 1, x=2) is False53 assert check_valid(f, 1, y=2) is False54 assert check_valid(f, 1, 2) is False55 assert check_valid(f, x=1, y=2) is False56 f = make_func('x=1')57 assert check_valid(f)58 assert check_valid(f, 1)59 assert check_valid(f, x=1)60 assert check_valid(f, 1, x=2) is False61 assert check_valid(f, 1, y=2) is False62 assert check_valid(f, 1, 2) is False63 assert check_valid(f, x=1, y=2) is False64 f = make_func('*args')65 assert check_valid(f)66 assert check_valid(f, 1)67 assert check_valid(f, 1, 2)68 assert check_valid(f, x=1) is False69 f = make_func('**kwargs')70 assert check_valid(f)71 assert check_valid(f, x=1)72 assert check_valid(f, x=1, y=2)73 assert check_valid(f, 1) is False74 f = make_func('x, *args')75 assert check_valid(f) is incomplete76 assert check_valid(f, 1)77 assert check_valid(f, 1, 2)78 assert check_valid(f, x=1)79 assert check_valid(f, 1, x=1) is False80 assert check_valid(f, 1, y=1) is False81 f = make_func('x, y=1, **kwargs')82 assert check_valid(f) is incomplete83 assert check_valid(f, 1)84 assert check_valid(f, x=1)85 assert check_valid(f, 1, 2)86 assert check_valid(f, x=1, y=2, z=3)87 assert check_valid(f, 1, 2, y=3) is False88 f = make_func('a, b, c=3, d=4')89 assert check_valid(f) is incomplete90 assert check_valid(f, 1) is incomplete91 assert check_valid(f, 1, 2)92 assert check_valid(f, 1, c=3) is incomplete93 assert check_valid(f, 1, e=3) is False94 assert check_valid(f, 1, 2, e=3) is False95 assert check_valid(f, 1, 2, b=3) is False96 assert check_valid(1) is False97def test_is_valid_py3(check_valid=is_valid_args, incomplete=False):98 if not PY3:99 return100 orig_check_valid = check_valid101 check_valid = lambda func, *args, **kwargs: orig_check_valid(func, args, kwargs)102 f = make_func('x, *, y=1')103 assert check_valid(f) is incomplete104 assert check_valid(f, 1)105 assert check_valid(f, x=1)106 assert check_valid(f, 1, y=2)107 assert check_valid(f, 1, 2) is False108 assert check_valid(f, 1, z=2) is False109 f = make_func('x, *args, y=1')110 assert check_valid(f) is incomplete111 assert check_valid(f, 1)112 assert check_valid(f, x=1)113 assert check_valid(f, 1, y=2)114 assert check_valid(f, 1, 2, y=2)115 assert check_valid(f, 1, 2)116 assert check_valid(f, 1, z=2) is False117 f = make_func('*, y=1')118 assert check_valid(f)119 assert check_valid(f, 1) is False120 assert check_valid(f, y=1)121 assert check_valid(f, z=1) is False122 f = make_func('x, *, y')123 assert check_valid(f) is incomplete124 assert check_valid(f, 1) is incomplete125 assert check_valid(f, x=1) is incomplete126 assert check_valid(f, 1, y=2)127 assert check_valid(f, x=1, y=2)128 assert check_valid(f, 1, 2) is False129 assert check_valid(f, 1, z=2) is False130 assert check_valid(f, 1, y=1, z=2) is False131 f = make_func('x=1, *, y, z=3')132 assert check_valid(f) is incomplete133 assert check_valid(f, 1, z=3) is incomplete134 assert check_valid(f, y=2)135 assert check_valid(f, 1, y=2)136 assert check_valid(f, x=1, y=2)137 assert check_valid(f, x=1, y=2, z=3)138 assert check_valid(f, 1, x=1, y=2) is False139 assert check_valid(f, 1, 3, y=2) is False140 f = make_func('w, x=2, *args, y, z=4')141 assert check_valid(f) is incomplete142 assert check_valid(f, 1) is incomplete143 assert check_valid(f, 1, y=3)144 f = make_func('a, b, c=3, d=4, *args, e=5, f=6, g, h')145 assert check_valid(f) is incomplete146 assert check_valid(f, 1) is incomplete147 assert check_valid(f, 1, 2) is incomplete148 assert check_valid(f, 1, 2, g=7) is incomplete149 assert check_valid(f, 1, 2, g=7, h=8)150 assert check_valid(f, 1, 2, 3, 4, 5, 6, 7, 8, 9) is incomplete151 f = make_func('a: int, b: float')152 assert check_valid(f) is incomplete153 assert check_valid(f, 1) is incomplete154 assert check_valid(f, b=1) is incomplete155 assert check_valid(f, 1, 2)156 f = make_func('(a: int, b: float) -> float')157 assert check_valid(f) is incomplete158 assert check_valid(f, 1) is incomplete159 assert check_valid(f, b=1) is incomplete160 assert check_valid(f, 1, 2)161 f.__signature__ = 34162 assert check_valid(f) is False163 class RaisesValueError(object):164 def __call__(self):165 pass166 @property167 def __signature__(self):168 raise ValueError('Testing Python 3.4')169 f = RaisesValueError()170 assert check_valid(f) is None171def test_is_partial():172 test_is_valid(check_valid=is_partial_args, incomplete=True)173 test_is_valid_py3(check_valid=is_partial_args, incomplete=True)174def test_is_valid_curry():175 def check_curry(func, args, kwargs, incomplete=True):176 try:177 curry(func)(*args, **kwargs)178 curry(func, *args)(**kwargs)179 curry(func, **kwargs)(*args)180 curry(func, *args, **kwargs)()181 if not isinstance(func, type(lambda: None)):182 return None183 return incomplete184 except ValueError:185 return True186 except TypeError:187 return False188 check_valid = functools.partial(check_curry, incomplete=True)189 test_is_valid(check_valid=check_valid, incomplete=True)190 test_is_valid_py3(check_valid=check_valid, incomplete=True)191 check_valid = functools.partial(check_curry, incomplete=False)192 test_is_valid(check_valid=check_valid, incomplete=False)193 test_is_valid_py3(check_valid=check_valid, incomplete=False)194def test_func_keyword():195 def f(func=None):196 pass197 assert is_valid_args(f, (), {})198 assert is_valid_args(f, (None,), {})199 assert is_valid_args(f, (), {'func': None})200 assert is_valid_args(f, (None,), {'func': None}) is False201 assert is_partial_args(f, (), {})202 assert is_partial_args(f, (None,), {})203 assert is_partial_args(f, (), {'func': None})204 assert is_partial_args(f, (None,), {'func': None}) is False205def test_has_unknown_args():206 assert has_varargs(1) is False207 assert has_varargs(map)208 assert has_varargs(make_func('')) is False209 assert has_varargs(make_func('x, y, z')) is False210 assert has_varargs(make_func('*args'))211 assert has_varargs(make_func('**kwargs')) is False212 assert has_varargs(make_func('x, y, *args, **kwargs'))213 assert has_varargs(make_func('x, y, z=1')) is False214 assert has_varargs(make_func('x, y, z=1, **kwargs')) is False215 if PY3:216 f = make_func('*args')217 f.__signature__ = 34218 assert has_varargs(f) is False219 class RaisesValueError(object):220 def __call__(self):221 pass222 @property223 def __signature__(self):224 raise ValueError('Testing Python 3.4')225 f = RaisesValueError()226 assert has_varargs(f) is None227def test_num_required_args():228 assert num_required_args(lambda: None) == 0229 assert num_required_args(lambda x: None) == 1230 assert num_required_args(lambda x, *args: None) == 1231 assert num_required_args(lambda x, **kwargs: None) == 1232 assert num_required_args(lambda x, y, *args, **kwargs: None) == 2233 assert num_required_args(map) == 2234 assert num_required_args(dict) is None235def test_has_keywords():236 assert has_keywords(lambda: None) is False237 assert has_keywords(lambda x: None) is False238 assert has_keywords(lambda x=1: None)239 assert has_keywords(lambda **kwargs: None)240 assert has_keywords(int)241 assert has_keywords(sorted)242 assert has_keywords(max)243 assert has_keywords(map) is False244 assert has_keywords(bytearray) is None245def test_has_varargs():246 assert has_varargs(lambda: None) is False247 assert has_varargs(lambda *args: None)248 assert has_varargs(lambda **kwargs: None) is False249 assert has_varargs(map)250 if PY3:251 assert has_varargs(max) is None252def test_is_arity():253 assert is_arity(0, lambda: None)254 assert is_arity(1, lambda: None) is False255 assert is_arity(1, lambda x: None)256 assert is_arity(3, lambda x, y, z: None)257 assert is_arity(1, lambda x, *args: None) is False258 assert is_arity(1, lambda x, **kwargs: None) is False259 assert is_arity(1, all)260 assert is_arity(2, map) is False261 assert is_arity(2, range) is None262def test_introspect_curry_valid_py3(check_valid=is_valid_args, incomplete=False):263 if not PY3:264 return265 orig_check_valid = check_valid266 check_valid = lambda _func, *args, **kwargs: orig_check_valid(_func, args, kwargs)267 f = toolz.curry(make_func('x, y, z=0'))268 assert check_valid(f)269 assert check_valid(f, 1)270 assert check_valid(f, 1, 2)271 assert check_valid(f, 1, 2, 3)272 assert check_valid(f, 1, 2, 3, 4) is False273 assert check_valid(f, invalid_keyword=True) is False274 assert check_valid(f(1))275 assert check_valid(f(1), 2)276 assert check_valid(f(1), 2, 3)277 assert check_valid(f(1), 2, 3, 4) is False278 assert check_valid(f(1), x=2) is False279 assert check_valid(f(1), y=2)280 assert check_valid(f(x=1), 2) is False281 assert check_valid(f(x=1), y=2)282 assert check_valid(f(y=2), 1)283 assert check_valid(f(y=2), 1, z=3)284 assert check_valid(f(y=2), 1, 3) is False285 f = toolz.curry(make_func('x, y, z=0'), 1, x=1)286 assert check_valid(f) is False287 assert check_valid(f, z=3) is False288 f = toolz.curry(make_func('x, y, *args, z'))289 assert check_valid(f)290 assert check_valid(f, 0)291 assert check_valid(f(1), 0)292 assert check_valid(f(1, 2), 0)293 assert check_valid(f(1, 2, 3), 0)294 assert check_valid(f(1, 2, 3, 4), 0)295 assert check_valid(f(1, 2, 3, 4), z=4)296 assert check_valid(f(x=1))297 assert check_valid(f(x=1), 1) is False298 assert check_valid(f(x=1), y=2)299def test_introspect_curry_partial_py3():300 test_introspect_curry_valid_py3(check_valid=is_partial_args, incomplete=True)301def test_introspect_curry_py3():302 if not PY3:303 return304 f = toolz.curry(make_func(''))305 assert num_required_args(f) == 0306 assert is_arity(0, f)307 assert has_varargs(f) is False308 assert has_keywords(f) is False309 f = toolz.curry(make_func('x'))310 assert num_required_args(f) == 0311 assert is_arity(0, f) is False312 assert is_arity(1, f) is False...
test_inspect_args.py
Source:test_inspect_args.py
...39 assert f(x=1, y=2)40 assert raises(TypeError, lambda: f(1, 2, 3))41def test_is_valid(check_valid=is_valid_args, incomplete=False):42 orig_check_valid = check_valid43 check_valid = lambda func, *args, **kwargs: orig_check_valid(func, args, kwargs)44 f = make_func('')45 assert check_valid(f)46 assert check_valid(f, 1) is False47 assert check_valid(f, x=1) is False48 f = make_func('x')49 assert check_valid(f) is incomplete50 assert check_valid(f, 1)51 assert check_valid(f, x=1)52 assert check_valid(f, 1, x=2) is False53 assert check_valid(f, 1, y=2) is False54 assert check_valid(f, 1, 2) is False55 assert check_valid(f, x=1, y=2) is False56 f = make_func('x=1')57 assert check_valid(f)58 assert check_valid(f, 1)59 assert check_valid(f, x=1)60 assert check_valid(f, 1, x=2) is False61 assert check_valid(f, 1, y=2) is False62 assert check_valid(f, 1, 2) is False63 assert check_valid(f, x=1, y=2) is False64 f = make_func('*args')65 assert check_valid(f)66 assert check_valid(f, 1)67 assert check_valid(f, 1, 2)68 assert check_valid(f, x=1) is False69 f = make_func('**kwargs')70 assert check_valid(f)71 assert check_valid(f, x=1)72 assert check_valid(f, x=1, y=2)73 assert check_valid(f, 1) is False74 f = make_func('x, *args')75 assert check_valid(f) is incomplete76 assert check_valid(f, 1)77 assert check_valid(f, 1, 2)78 assert check_valid(f, x=1)79 assert check_valid(f, 1, x=1) is False80 assert check_valid(f, 1, y=1) is False81 f = make_func('x, y=1, **kwargs')82 assert check_valid(f) is incomplete83 assert check_valid(f, 1)84 assert check_valid(f, x=1)85 assert check_valid(f, 1, 2)86 assert check_valid(f, x=1, y=2, z=3)87 assert check_valid(f, 1, 2, y=3) is False88 f = make_func('a, b, c=3, d=4')89 assert check_valid(f) is incomplete90 assert check_valid(f, 1) is incomplete91 assert check_valid(f, 1, 2)92 assert check_valid(f, 1, c=3) is incomplete93 assert check_valid(f, 1, e=3) is False94 assert check_valid(f, 1, 2, e=3) is False95 assert check_valid(f, 1, 2, b=3) is False96 assert check_valid(1) is False97def test_is_valid_py3(check_valid=is_valid_args, incomplete=False):98 if not PY3:99 return100 orig_check_valid = check_valid101 check_valid = lambda func, *args, **kwargs: orig_check_valid(func, args, kwargs)102 f = make_func('x, *, y=1')103 assert check_valid(f) is incomplete104 assert check_valid(f, 1)105 assert check_valid(f, x=1)106 assert check_valid(f, 1, y=2)107 assert check_valid(f, 1, 2) is False108 assert check_valid(f, 1, z=2) is False109 f = make_func('x, *args, y=1')110 assert check_valid(f) is incomplete111 assert check_valid(f, 1)112 assert check_valid(f, x=1)113 assert check_valid(f, 1, y=2)114 assert check_valid(f, 1, 2, y=2)115 assert check_valid(f, 1, 2)116 assert check_valid(f, 1, z=2) is False117 f = make_func('*, y=1')118 assert check_valid(f)119 assert check_valid(f, 1) is False120 assert check_valid(f, y=1)121 assert check_valid(f, z=1) is False122 f = make_func('x, *, y')123 assert check_valid(f) is incomplete124 assert check_valid(f, 1) is incomplete125 assert check_valid(f, x=1) is incomplete126 assert check_valid(f, 1, y=2)127 assert check_valid(f, x=1, y=2)128 assert check_valid(f, 1, 2) is False129 assert check_valid(f, 1, z=2) is False130 assert check_valid(f, 1, y=1, z=2) is False131 f = make_func('x=1, *, y, z=3')132 assert check_valid(f) is incomplete133 assert check_valid(f, 1, z=3) is incomplete134 assert check_valid(f, y=2)135 assert check_valid(f, 1, y=2)136 assert check_valid(f, x=1, y=2)137 assert check_valid(f, x=1, y=2, z=3)138 assert check_valid(f, 1, x=1, y=2) is False139 assert check_valid(f, 1, 3, y=2) is False140 f = make_func('w, x=2, *args, y, z=4')141 assert check_valid(f) is incomplete142 assert check_valid(f, 1) is incomplete143 assert check_valid(f, 1, y=3)144 f = make_func('a, b, c=3, d=4, *args, e=5, f=6, g, h')145 assert check_valid(f) is incomplete146 assert check_valid(f, 1) is incomplete147 assert check_valid(f, 1, 2) is incomplete148 assert check_valid(f, 1, 2, g=7) is incomplete149 assert check_valid(f, 1, 2, g=7, h=8)150 assert check_valid(f, 1, 2, 3, 4, 5, 6, 7, 8, 9) is incomplete151 f = make_func('a: int, b: float')152 assert check_valid(f) is incomplete153 assert check_valid(f, 1) is incomplete154 assert check_valid(f, b=1) is incomplete155 assert check_valid(f, 1, 2)156 f = make_func('(a: int, b: float) -> float')157 assert check_valid(f) is incomplete158 assert check_valid(f, 1) is incomplete159 assert check_valid(f, b=1) is incomplete160 assert check_valid(f, 1, 2)161 f.__signature__ = 34162 assert check_valid(f) is False163 class RaisesValueError(object):164 def __call__(self):165 pass166 @property167 def __signature__(self):168 raise ValueError('Testing Python 3.4')169 f = RaisesValueError()170 assert check_valid(f) is None171def test_is_partial():172 test_is_valid(check_valid=is_partial_args, incomplete=True)173 test_is_valid_py3(check_valid=is_partial_args, incomplete=True)174def test_is_valid_curry():175 def check_curry(func, args, kwargs, incomplete=True):176 try:177 curry(func)(*args, **kwargs)178 curry(func, *args)(**kwargs)179 curry(func, **kwargs)(*args)180 curry(func, *args, **kwargs)()181 if not isinstance(func, type(lambda: None)):182 return None183 return incomplete184 except ValueError:185 return True186 except TypeError:187 return False188 check_valid = functools.partial(check_curry, incomplete=True)189 test_is_valid(check_valid=check_valid, incomplete=True)190 test_is_valid_py3(check_valid=check_valid, incomplete=True)191 check_valid = functools.partial(check_curry, incomplete=False)192 test_is_valid(check_valid=check_valid, incomplete=False)193 test_is_valid_py3(check_valid=check_valid, incomplete=False)194def test_func_keyword():195 def f(func=None):196 pass197 assert is_valid_args(f, (), {})198 assert is_valid_args(f, (None,), {})199 assert is_valid_args(f, (), {'func': None})200 assert is_valid_args(f, (None,), {'func': None}) is False201 assert is_partial_args(f, (), {})202 assert is_partial_args(f, (None,), {})203 assert is_partial_args(f, (), {'func': None})204 assert is_partial_args(f, (None,), {'func': None}) is False205def test_has_unknown_args():206 assert has_varargs(1) is False207 assert has_varargs(map)208 assert has_varargs(make_func('')) is False209 assert has_varargs(make_func('x, y, z')) is False210 assert has_varargs(make_func('*args'))211 assert has_varargs(make_func('**kwargs')) is False212 assert has_varargs(make_func('x, y, *args, **kwargs'))213 assert has_varargs(make_func('x, y, z=1')) is False214 assert has_varargs(make_func('x, y, z=1, **kwargs')) is False215 if PY3:216 f = make_func('*args')217 f.__signature__ = 34218 assert has_varargs(f) is False219 class RaisesValueError(object):220 def __call__(self):221 pass222 @property223 def __signature__(self):224 raise ValueError('Testing Python 3.4')225 f = RaisesValueError()226 assert has_varargs(f) is None227def test_num_required_args():228 assert num_required_args(lambda: None) == 0229 assert num_required_args(lambda x: None) == 1230 assert num_required_args(lambda x, *args: None) == 1231 assert num_required_args(lambda x, **kwargs: None) == 1232 assert num_required_args(lambda x, y, *args, **kwargs: None) == 2233 assert num_required_args(map) == 2234 assert num_required_args(dict) is None235def test_has_keywords():236 assert has_keywords(lambda: None) is False237 assert has_keywords(lambda x: None) is False238 assert has_keywords(lambda x=1: None)239 assert has_keywords(lambda **kwargs: None)240 assert has_keywords(int)241 assert has_keywords(sorted)242 assert has_keywords(max)243 assert has_keywords(map) is False244 assert has_keywords(bytearray) is None245def test_has_varargs():246 assert has_varargs(lambda: None) is False247 assert has_varargs(lambda *args: None)248 assert has_varargs(lambda **kwargs: None) is False249 assert has_varargs(map)250 if PY3:251 assert has_varargs(max) is None252def test_is_arity():253 assert is_arity(0, lambda: None)254 assert is_arity(1, lambda: None) is False255 assert is_arity(1, lambda x: None)256 assert is_arity(3, lambda x, y, z: None)257 assert is_arity(1, lambda x, *args: None) is False258 assert is_arity(1, lambda x, **kwargs: None) is False259 assert is_arity(1, all)260 assert is_arity(2, map) is False261 assert is_arity(2, range) is None262def test_introspect_curry_valid_py3(check_valid=is_valid_args, incomplete=False):263 if not PY3:264 return265 orig_check_valid = check_valid266 check_valid = lambda _func, *args, **kwargs: orig_check_valid(_func, args, kwargs)267 f = toolz.curry(make_func('x, y, z=0'))268 assert check_valid(f)269 assert check_valid(f, 1)270 assert check_valid(f, 1, 2)271 assert check_valid(f, 1, 2, 3)272 assert check_valid(f, 1, 2, 3, 4) is False273 assert check_valid(f, invalid_keyword=True) is False274 assert check_valid(f(1))275 assert check_valid(f(1), 2)276 assert check_valid(f(1), 2, 3)277 assert check_valid(f(1), 2, 3, 4) is False278 assert check_valid(f(1), x=2) is False279 assert check_valid(f(1), y=2)280 assert check_valid(f(x=1), 2) is False281 assert check_valid(f(x=1), y=2)282 assert check_valid(f(y=2), 1)283 assert check_valid(f(y=2), 1, z=3)284 assert check_valid(f(y=2), 1, 3) is False285 f = toolz.curry(make_func('x, y, z=0'), 1, x=1)286 assert check_valid(f) is False287 assert check_valid(f, z=3) is False288 f = toolz.curry(make_func('x, y, *args, z'))289 assert check_valid(f)290 assert check_valid(f, 0)291 assert check_valid(f(1), 0)292 assert check_valid(f(1, 2), 0)293 assert check_valid(f(1, 2, 3), 0)294 assert check_valid(f(1, 2, 3, 4), 0)295 assert check_valid(f(1, 2, 3, 4), z=4)296 assert check_valid(f(x=1))297 assert check_valid(f(x=1), 1) is False298 assert check_valid(f(x=1), y=2)299def test_introspect_curry_partial_py3():300 test_introspect_curry_valid_py3(check_valid=is_partial_args, incomplete=True)301def test_introspect_curry_py3():302 if not PY3:303 return304 f = toolz.curry(make_func(''))305 assert num_required_args(f) == 0306 assert is_arity(0, f)307 assert has_varargs(f) is False308 assert has_keywords(f) is False309 f = toolz.curry(make_func('x'))310 assert num_required_args(f) == 0311 assert is_arity(0, f) is False312 assert is_arity(1, f) is False...
11457_test_signatures.py
Source:11457_test_signatures.py
...3from toolz._signatures import builtins, _is_valid_args, _is_partial_args4from toolz.compatibility import PY35def test_is_valid(check_valid=_is_valid_args, incomplete=False):6 orig_check_valid = check_valid7 check_valid = lambda func, *args, **kwargs: orig_check_valid(func, args, kwargs)8 assert check_valid(lambda x: None) is None9 f = builtins.abs10 assert check_valid(f) is incomplete11 assert check_valid(f, 1)12 assert check_valid(f, x=1) is False13 assert check_valid(f, 1, 2) is False14 f = builtins.complex15 assert check_valid(f)16 assert check_valid(f, 1)17 assert check_valid(f, real=1)18 assert check_valid(f, 1, 2)19 assert check_valid(f, 1, imag=2)20 assert check_valid(f, 1, real=2) is False21 assert check_valid(f, 1, 2, 3) is False22 assert check_valid(f, 1, 2, imag=3) is False23 f = builtins.int24 assert check_valid(f)25 assert check_valid(f, 1)26 assert check_valid(f, x=1)27 assert check_valid(f, 1, 2)28 assert check_valid(f, 1, base=2)29 assert check_valid(f, x=1, base=2)30 assert check_valid(f, base=2) is incomplete31 assert check_valid(f, 1, 2, 3) is False32 f = builtins.map33 assert check_valid(f) is incomplete34 assert check_valid(f, 1) is incomplete35 assert check_valid(f, 1, 2)36 assert check_valid(f, 1, 2, 3)37 assert check_valid(f, 1, 2, 3, 4)38 f = builtins.min39 assert check_valid(f) is incomplete40 assert check_valid(f, 1)41 assert check_valid(f, iterable=1) is False42 assert check_valid(f, 1, 2)43 assert check_valid(f, 1, 2, 3)44 assert check_valid(f, key=None) is incomplete45 assert check_valid(f, 1, key=None)46 assert check_valid(f, 1, 2, key=None)47 assert check_valid(f, 1, 2, 3, key=None)48 assert check_valid(f, key=None, default=None) is (PY3 and incomplete)49 assert check_valid(f, 1, key=None, default=None) is PY350 assert check_valid(f, 1, 2, key=None, default=None) is False51 assert check_valid(f, 1, 2, 3, key=None, default=None) is False52 f = builtins.range53 assert check_valid(f) is incomplete54 assert check_valid(f, 1)55 assert check_valid(f, 1, 2)56 assert check_valid(f, 1, 2, 3)57 assert check_valid(f, 1, 2, step=3) is False58 assert check_valid(f, 1, 2, 3, 4) is False59 f = functools.partial60 assert orig_check_valid(f, (), {}) is incomplete61 assert orig_check_valid(f, (), {'func': 1}) is incomplete62 assert orig_check_valid(f, (1,), {})63 assert orig_check_valid(f, (1,), {'func': 1})64 assert orig_check_valid(f, (1, 2), {})65def test_is_partial():66 test_is_valid(check_valid=_is_partial_args, incomplete=True)67def test_for_coverage(): # :)68 assert _sigs._is_arity(1, 1) is None69 assert _sigs._is_arity(1, all)70 assert _sigs._has_varargs(None) is None71 assert _sigs._has_keywords(None) is None...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!