Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if output:
assert rout
else:
assert not rout
else:
assert rout == output
_assert_outerr(rout, output)
_assert_outerr(rerr, err)
directory = tmpdir.mkdir("tmp")
tempfile = directory.join("tmp.log")
path = str(tempfile)
_pip.call("install", "pipupgrade")
assert_pip_call(_pip.call("install", "pipupgrade", quiet = True))
_pip.call("install", "pipupgrade", log = path)
assert tempfile.read()
def _assert_confirm(stdout):
assert_input(capfd, query, "Y", expected = True, input_ = cli.confirm, stdout = stdout)
assert_input(capfd, query, "y", expected = True, input_ = cli.confirm, stdout = stdout)
assert_input(capfd, query,"\n", expected = True, input_ = cli.confirm, stdout = stdout)
assert_input(capfd, query, "n", expected = False, input_ = cli.confirm, stdout = stdout)
assert_input(capfd, query, "1", expected = False, input_ = cli.confirm, stdout = stdout)
@cli.command
def foobar(*args, **kwargs):
args = get_args()
params = merge_dict(args, override)
for k, v in iteritems(values):
assert params[k] == v
if initial:
for k in iterkeys(initial):
assert initial[k] == args[k]
def test_strip():
string = "foobar"
assert strip(string) == string
string = "\n foobar\nfoobar \n "
assert strip(string) == "foobar\nfoobar"
string = "\n\n\n"
assert strip(string) == ""
def test_strip():
string = "foobar"
assert strip(string) == string
string = "\n foobar\nfoobar \n "
assert strip(string) == "foobar\nfoobar"
string = "\n\n\n"
assert strip(string) == ""
else:
assert not rout
else:
assert rout == output
_assert_outerr(rout, output)
_assert_outerr(rerr, err)
directory = tmpdir.mkdir("tmp")
tempfile = directory.join("tmp.log")
path = str(tempfile)
_pip.call("install", "pipupgrade")
assert_pip_call(_pip.call("install", "pipupgrade", quiet = True))
_pip.call("install", "pipupgrade", log = path)
assert tempfile.read()
if isinstance(output, bool):
if output:
assert rout
else:
assert not rout
else:
assert rout == output
_assert_outerr(rout, output)
_assert_outerr(rerr, err)
directory = tmpdir.mkdir("tmp")
tempfile = directory.join("tmp.log")
path = str(tempfile)
_pip.call("install", "pipupgrade")
assert_pip_call(_pip.call("install", "pipupgrade", quiet = True))
_pip.call("install", "pipupgrade", log = path)
assert tempfile.read()
def test_echo(capfd):
query = "foobar"
cli.echo(query, nl = False)
assert_stdout(capfd, query)
cli.echo(query, nl = True)
assert_stdout(capfd, "{}\n".format(query))
def foobar(*args, **kwargs):
args = get_args()
params = merge_dict(args, override)
for k, v in iteritems(values):
assert params[k] == v
if initial:
for k in iterkeys(initial):
assert initial[k] == args[k]
def test_iteritems():
dict_ = dict(foo = "bar")
assert isinstance(iteritems(dict_), Iterable)
for k, v in iteritems(dict_):
assert dict_[k] == v