Commit f94a8f86 authored by Kirill Smelkov's avatar Kirill Smelkov

*_test: pytest.raises(string) is deprecated

	.../pygolang/golang/strconv_test.py:75: PytestDeprecationWarning: raises(..., 'code(as_a_string)') is deprecated, use the context manager form or use `exec()` directly
	...

See https://docs.pytest.org/en/latest/deprecations.html#raises-warns-with-a-string-as-the-second-argument
parent 50213c54
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
# Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
......@@ -57,8 +57,8 @@ def test_chan():
assert ch.recv() == None
assert ch.recv_() == (None, False)
assert ch.recv_() == (None, False)
raises(_PanicError, "ch.send(0)")
raises(_PanicError, "ch.close()")
with raises(_PanicError): ch.send(0)
with raises(_PanicError): ch.close()
# sync: send vs recv
ch = chan()
......@@ -78,7 +78,7 @@ def test_chan():
tdelay()
ch.close()
go(_)
raises(_PanicError, "ch.send(0)")
with raises(_PanicError): ch.send(0)
# close vs recv
ch = chan()
......@@ -450,7 +450,7 @@ def test_deferrecover():
defer(_)
1/0
raises(ZeroDivisionError, "_()")
with raises(ZeroDivisionError): _()
assert v == ['ran ok', 2, 1]
# defer without @func is caught and properly reported
......@@ -472,7 +472,7 @@ def test_deferrecover():
defer(lambda: panic(3))
defer(lambda: v.append(4))
raises(_PanicError, "_()")
with raises(_PanicError): _()
assert v == [4, 2, 1]
......@@ -509,7 +509,7 @@ def test_deferrecover():
panic("bbb")
raises(_PanicError, "_()")
with raises(_PanicError): _()
assert v == [3, 'recovered 1', 1]
......@@ -560,7 +560,7 @@ def test_deferrecover():
panic("zzz")
raises(_PanicError, "_()")
with raises(_PanicError): _()
assert v == ['not recovered']
......
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
# Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
......@@ -72,7 +72,7 @@ def test_quote():
assert unquote(tquoted) == tin
assert unquote_next(tquoted) == (tin, type(tin)())
assert unquote_next(tquoted + tail) == (tin, tail)
raises(ValueError, 'unquote(tquoted + tail)')
with raises(ValueError): unquote(tquoted + tail)
# qq always gives str
assert qq(tin) == asstr(tquoted)
......@@ -96,7 +96,7 @@ def test_quote():
assert unquote(tquoted) == tin
assert unquote_next(tquoted) == (tin, type(tin)())
assert unquote_next(tquoted + tail) == (tin, tail)
raises(ValueError, 'unquote(tquoted + tail)')
with raises(ValueError): unquote(tquoted + tail)
# qq always gives str
assert qq(tin) == asstr(tquoted)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment