Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-flake8-bugbear for
openSUSE:Factory checked in at 2023-05-18 15:19:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flake8-bugbear (Old)
and /work/SRC/openSUSE:Factory/.python-flake8-bugbear.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-flake8-bugbear"
Thu May 18 15:19:47 2023 rev:13 rq:1087744 version:23.5.9
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-flake8-bugbear/python-flake8-bugbear.changes
2023-04-28 16:25:17.758685317 +0200
+++
/work/SRC/openSUSE:Factory/.python-flake8-bugbear.new.1533/python-flake8-bugbear.changes
2023-05-18 15:19:56.734082335 +0200
@@ -1,0 +2,11 @@
+Thu May 18 07:02:43 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 23.5.9:
+ * Add B033: Detect duplicate items in sets
+ * Add B908: Detect assertRauses like contexts only has top
+ level statements that could throw
+ * Add B028: Allow stacklevel to be explicitly assigned as a
+ positional argument
+ * Remove more < 3.8 checks / assertions
+
+-------------------------------------------------------------------
Old:
----
flake8-bugbear-23.3.23.tar.gz
New:
----
flake8-bugbear-23.5.9.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-flake8-bugbear.spec ++++++
--- /var/tmp/diff_new_pack.glVlJh/_old 2023-05-18 15:19:57.242085450 +0200
+++ /var/tmp/diff_new_pack.glVlJh/_new 2023-05-18 15:19:57.250085499 +0200
@@ -19,7 +19,7 @@
%define skip_python2 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-flake8-bugbear
-Version: 23.3.23
+Version: 23.5.9
Release: 0
Summary: A plugin for flake8 finding likely bugs and design problems in
your program
License: MIT
++++++ flake8-bugbear-23.3.23.tar.gz -> flake8-bugbear-23.5.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flake8-bugbear-23.3.23/PKG-INFO
new/flake8-bugbear-23.5.9/PKG-INFO
--- old/flake8-bugbear-23.3.23/PKG-INFO 2023-03-23 15:46:17.355725000 +0100
+++ new/flake8-bugbear-23.5.9/PKG-INFO 2023-05-10 01:58:06.916914000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: flake8-bugbear
-Version: 23.3.23
+Version: 23.5.9
Summary: A plugin for flake8 finding likely bugs and design problems in your
program. Contains warnings that don't belong in pyflakes and pycodestyle.
Author-email: Åukasz Langa <[email protected]>
License: MIT
@@ -202,7 +202,7 @@
**B027**: Empty method in abstract base class, but has no abstract decorator.
Consider adding @abstractmethod.
-**B028**: No explicit stacklevel keyword argument found. The warn method from
the warnings module uses a
+**B028**: No explicit stacklevel argument found. The warn method from the
warnings module uses a
stacklevel of 1 by default. This will only show a stack trace for the line on
which the warn method is called.
It is therefore recommended to use a stacklevel of 2 or greater to provide
more information to the user.
@@ -215,6 +215,8 @@
**B032**: Possible unintentional type annotation (using ``:``). Did you mean
to assign (using ``=``)?
+**B033**: Sets should not contain duplicate items. Duplicate items will be
replaced with a single item at runtime.
+
Opinionated warnings
~~~~~~~~~~~~~~~~~~~~
@@ -257,6 +259,8 @@
**B907**: Consider replacing ``f"'{foo}'"`` with ``f"{foo!r}"`` which is both
easier to read and will escape quotes inside ``foo`` if that would appear. The
check tries to filter out any format specs that are invalid together with
``!r``. If you're using other conversion flags then e.g. ``f"'{foo!a}'"`` can
be replaced with ``f"{ascii(foo)!r}"``. Not currently implemented for
python<3.8 or ``str.format()`` calls.
+**B908**: Contexts with exceptions assertions like ``with self.assertRaises``
or ``with pytest.raises`` should not have multiple top-level statements. Each
statement should be in its own context. That way, the test ensures that the
exception is raised only in the exact statement where you expect it.
+
**B950**: Line too long. This is a pragmatic equivalent of
``pycodestyle``'s ``E501``: it considers "max-line-length" but only triggers
when the value has been exceeded by **more than 10%**. ``noqa`` and ``type:
ignore`` comments are ignored. You will no
@@ -354,12 +358,21 @@
Change Log
----------
+23.5.9
+~~~~~~
+
+* Add B033: Detect duplicate items in sets
+* Add B908: Detect assertRauses like contexts only has top level statements
that could throw
+* Add B028: Allow stacklevel to be explicitly assigned as a positional argument
+* Remove more < 3.8 checks / assertions
+
23.3.23
~~~~~~~~~~
* flake8-bugbear is now >= 3.8.1 project like flake8>=6.0.0
* This has allowed some more modern AST usage cleanup and less CI running
etc.
* B030: Fix crash on certain unusual except handlers (e.g. ``except a[0].b:``)
+* Add B033: Check for duplicate items in sets.
23.3.12
~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flake8-bugbear-23.3.23/README.rst
new/flake8-bugbear-23.5.9/README.rst
--- old/flake8-bugbear-23.3.23/README.rst 2023-03-23 15:46:07.000000000
+0100
+++ new/flake8-bugbear-23.5.9/README.rst 2023-05-10 01:57:52.000000000
+0200
@@ -173,7 +173,7 @@
**B027**: Empty method in abstract base class, but has no abstract decorator.
Consider adding @abstractmethod.
-**B028**: No explicit stacklevel keyword argument found. The warn method from
the warnings module uses a
+**B028**: No explicit stacklevel argument found. The warn method from the
warnings module uses a
stacklevel of 1 by default. This will only show a stack trace for the line on
which the warn method is called.
It is therefore recommended to use a stacklevel of 2 or greater to provide
more information to the user.
@@ -186,6 +186,8 @@
**B032**: Possible unintentional type annotation (using ``:``). Did you mean
to assign (using ``=``)?
+**B033**: Sets should not contain duplicate items. Duplicate items will be
replaced with a single item at runtime.
+
Opinionated warnings
~~~~~~~~~~~~~~~~~~~~
@@ -228,6 +230,8 @@
**B907**: Consider replacing ``f"'{foo}'"`` with ``f"{foo!r}"`` which is both
easier to read and will escape quotes inside ``foo`` if that would appear. The
check tries to filter out any format specs that are invalid together with
``!r``. If you're using other conversion flags then e.g. ``f"'{foo!a}'"`` can
be replaced with ``f"{ascii(foo)!r}"``. Not currently implemented for
python<3.8 or ``str.format()`` calls.
+**B908**: Contexts with exceptions assertions like ``with self.assertRaises``
or ``with pytest.raises`` should not have multiple top-level statements. Each
statement should be in its own context. That way, the test ensures that the
exception is raised only in the exact statement where you expect it.
+
**B950**: Line too long. This is a pragmatic equivalent of
``pycodestyle``'s ``E501``: it considers "max-line-length" but only triggers
when the value has been exceeded by **more than 10%**. ``noqa`` and ``type:
ignore`` comments are ignored. You will no
@@ -325,12 +329,21 @@
Change Log
----------
+23.5.9
+~~~~~~
+
+* Add B033: Detect duplicate items in sets
+* Add B908: Detect assertRauses like contexts only has top level statements
that could throw
+* Add B028: Allow stacklevel to be explicitly assigned as a positional argument
+* Remove more < 3.8 checks / assertions
+
23.3.23
~~~~~~~~~~
* flake8-bugbear is now >= 3.8.1 project like flake8>=6.0.0
* This has allowed some more modern AST usage cleanup and less CI running
etc.
* B030: Fix crash on certain unusual except handlers (e.g. ``except a[0].b:``)
+* Add B033: Check for duplicate items in sets.
23.3.12
~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flake8-bugbear-23.3.23/bugbear.py
new/flake8-bugbear-23.5.9/bugbear.py
--- old/flake8-bugbear-23.3.23/bugbear.py 2023-03-23 15:46:07.000000000
+0100
+++ new/flake8-bugbear-23.5.9/bugbear.py 2023-05-10 01:57:52.000000000
+0200
@@ -13,7 +13,7 @@
import attr
import pycodestyle
-__version__ = "23.3.23"
+__version__ = "23.5.9"
LOG = logging.getLogger("flake8.bugbear")
CONTEXTFUL_NODES = (
@@ -28,6 +28,14 @@
ast.GeneratorExp,
)
FUNCTION_NODES = (ast.AsyncFunctionDef, ast.FunctionDef, ast.Lambda)
+B908_pytest_functions = {"raises", "warns"}
+B908_unittest_methods = {
+ "assertRaises",
+ "assertRaisesRegex",
+ "assertRaisesRegexp",
+ "assertWarns",
+ "assertWarnsRegex",
+}
Context = namedtuple("Context", ["node", "stack"])
@@ -504,6 +512,7 @@
def visit_With(self, node):
self.check_for_b017(node)
self.check_for_b022(node)
+ self.check_for_b908(node)
self.generic_visit(node)
def visit_JoinedStr(self, node):
@@ -518,6 +527,10 @@
self.check_for_b005(node)
self.generic_visit(node)
+ def visit_Set(self, node):
+ self.check_for_b033(node)
+ self.generic_visit(node)
+
def check_for_b005(self, node):
if isinstance(node, ast.Import):
for name in node.names:
@@ -1104,6 +1117,39 @@
):
self.errors.append(B022(node.lineno, node.col_offset))
+ @staticmethod
+ def _is_assertRaises_like(node: ast.withitem) -> bool:
+ if not (
+ isinstance(node, ast.withitem)
+ and isinstance(node.context_expr, ast.Call)
+ and isinstance(node.context_expr.func, (ast.Attribute, ast.Name))
+ ):
+ return False
+ if isinstance(node.context_expr.func, ast.Name):
+ # "with raises"
+ return node.context_expr.func.id in B908_pytest_functions
+ elif isinstance(node.context_expr.func, ast.Attribute) and isinstance(
+ node.context_expr.func.value, ast.Name
+ ):
+ return (
+ # "with pytest.raises"
+ node.context_expr.func.value.id == "pytest"
+ and node.context_expr.func.attr in B908_pytest_functions
+ ) or (
+ # "with self.assertRaises"
+ node.context_expr.func.value.id == "self"
+ and node.context_expr.func.attr in B908_unittest_methods
+ )
+ else:
+ return False
+
+ def check_for_b908(self, node: ast.With):
+ if len(node.body) < 2:
+ return
+ for node_item in node.items:
+ if self._is_assertRaises_like(node_item):
+ self.errors.append(B908(node.lineno, node.col_offset))
+
def check_for_b025(self, node):
seen = []
for handler in node.handlers:
@@ -1174,11 +1220,6 @@
self.errors.append(B906(node.lineno, node.col_offset))
def check_for_b907(self, node: ast.JoinedStr): # noqa: C901
- # AST structure of strings in f-strings in 3.7 is different enough this
- # implementation doesn't work
- if sys.version_info <= (3, 7):
- return # pragma: no cover
-
def myunparse(node: ast.AST) -> str: # pragma: no cover
if sys.version_info >= (3, 9):
return ast.unparse(node)
@@ -1290,6 +1331,7 @@
and isinstance(node.func.value, ast.Name)
and node.func.value.id == "warnings"
and not any(kw.arg == "stacklevel" for kw in node.keywords)
+ and len(node.args) < 3
):
self.errors.append(B028(node.lineno, node.col_offset))
@@ -1308,6 +1350,14 @@
):
self.errors.append(B032(node.lineno, node.col_offset))
+ def check_for_b033(self, node):
+ constants = [
+ item.value
+ for item in filter(lambda x: isinstance(x, ast.Constant),
node.elts)
+ ]
+ if len(constants) != len(set(constants)):
+ self.errors.append(B033(node.lineno, node.col_offset))
+
def compose_call_path(node):
if isinstance(node, ast.Attribute):
@@ -1674,7 +1724,7 @@
)
B028 = Error(
message=(
- "B028 No explicit stacklevel keyword argument found. The warn method
from the"
+ "B028 No explicit stacklevel argument found. The warn method from the"
" warnings module uses a stacklevel of 1 by default. This will only
show a"
" stack trace for the line on which the warn method is called."
" It is therefore recommended to use a stacklevel of 2 or"
@@ -1705,6 +1755,13 @@
)
)
+B033 = Error(
+ message=(
+ "B033 Sets should not contain duplicate items. Duplicate items will be
replaced"
+ " with a single item at runtime."
+ )
+)
+
# Warnings disabled by default.
B901 = Error(
message=(
@@ -1758,7 +1815,12 @@
" flag."
)
)
-
+B908 = Error(
+ message=(
+ "B908 assertRaises-type context should not contains more than one
top-level"
+ " statement."
+ )
+)
B950 = Error(message="B950 line too long ({} > {} characters)")
-disabled_by_default = ["B901", "B902", "B903", "B904", "B905", "B906", "B950"]
+disabled_by_default = ["B901", "B902", "B903", "B904", "B905", "B906", "B908",
"B950"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/flake8-bugbear-23.3.23/flake8_bugbear.egg-info/PKG-INFO
new/flake8-bugbear-23.5.9/flake8_bugbear.egg-info/PKG-INFO
--- old/flake8-bugbear-23.3.23/flake8_bugbear.egg-info/PKG-INFO 2023-03-23
15:46:17.000000000 +0100
+++ new/flake8-bugbear-23.5.9/flake8_bugbear.egg-info/PKG-INFO 2023-05-10
01:58:06.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: flake8-bugbear
-Version: 23.3.23
+Version: 23.5.9
Summary: A plugin for flake8 finding likely bugs and design problems in your
program. Contains warnings that don't belong in pyflakes and pycodestyle.
Author-email: Åukasz Langa <[email protected]>
License: MIT
@@ -202,7 +202,7 @@
**B027**: Empty method in abstract base class, but has no abstract decorator.
Consider adding @abstractmethod.
-**B028**: No explicit stacklevel keyword argument found. The warn method from
the warnings module uses a
+**B028**: No explicit stacklevel argument found. The warn method from the
warnings module uses a
stacklevel of 1 by default. This will only show a stack trace for the line on
which the warn method is called.
It is therefore recommended to use a stacklevel of 2 or greater to provide
more information to the user.
@@ -215,6 +215,8 @@
**B032**: Possible unintentional type annotation (using ``:``). Did you mean
to assign (using ``=``)?
+**B033**: Sets should not contain duplicate items. Duplicate items will be
replaced with a single item at runtime.
+
Opinionated warnings
~~~~~~~~~~~~~~~~~~~~
@@ -257,6 +259,8 @@
**B907**: Consider replacing ``f"'{foo}'"`` with ``f"{foo!r}"`` which is both
easier to read and will escape quotes inside ``foo`` if that would appear. The
check tries to filter out any format specs that are invalid together with
``!r``. If you're using other conversion flags then e.g. ``f"'{foo!a}'"`` can
be replaced with ``f"{ascii(foo)!r}"``. Not currently implemented for
python<3.8 or ``str.format()`` calls.
+**B908**: Contexts with exceptions assertions like ``with self.assertRaises``
or ``with pytest.raises`` should not have multiple top-level statements. Each
statement should be in its own context. That way, the test ensures that the
exception is raised only in the exact statement where you expect it.
+
**B950**: Line too long. This is a pragmatic equivalent of
``pycodestyle``'s ``E501``: it considers "max-line-length" but only triggers
when the value has been exceeded by **more than 10%**. ``noqa`` and ``type:
ignore`` comments are ignored. You will no
@@ -354,12 +358,21 @@
Change Log
----------
+23.5.9
+~~~~~~
+
+* Add B033: Detect duplicate items in sets
+* Add B908: Detect assertRauses like contexts only has top level statements
that could throw
+* Add B028: Allow stacklevel to be explicitly assigned as a positional argument
+* Remove more < 3.8 checks / assertions
+
23.3.23
~~~~~~~~~~
* flake8-bugbear is now >= 3.8.1 project like flake8>=6.0.0
* This has allowed some more modern AST usage cleanup and less CI running
etc.
* B030: Fix crash on certain unusual except handlers (e.g. ``except a[0].b:``)
+* Add B033: Check for duplicate items in sets.
23.3.12
~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/flake8-bugbear-23.3.23/flake8_bugbear.egg-info/SOURCES.txt
new/flake8-bugbear-23.5.9/flake8_bugbear.egg-info/SOURCES.txt
--- old/flake8-bugbear-23.3.23/flake8_bugbear.egg-info/SOURCES.txt
2023-03-23 15:46:17.000000000 +0100
+++ new/flake8-bugbear-23.5.9/flake8_bugbear.egg-info/SOURCES.txt
2023-05-10 01:58:06.000000000 +0200
@@ -46,6 +46,7 @@
tests/b030.py
tests/b031.py
tests/b032.py
+tests/b033.py
tests/b901.py
tests/b902.py
tests/b902_py38.py
@@ -54,5 +55,6 @@
tests/b905_py310.py
tests/b906.py
tests/b907.py
+tests/b908.py
tests/b950.py
tests/test_bugbear.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flake8-bugbear-23.3.23/tests/b028.py
new/flake8-bugbear-23.5.9/tests/b028.py
--- old/flake8-bugbear-23.3.23/tests/b028.py 2023-03-23 15:46:07.000000000
+0100
+++ new/flake8-bugbear-23.5.9/tests/b028.py 2023-05-10 01:57:52.000000000
+0200
@@ -5,7 +5,9 @@
B028 - on lines 8 and 9
"""
-warnings.warn(DeprecationWarning("test"))
-warnings.warn(DeprecationWarning("test"), source=None)
-warnings.warn(DeprecationWarning("test"), source=None, stacklevel=2)
-warnings.warn(DeprecationWarning("test"), stacklevel=1)
+warnings.warn("test", DeprecationWarning)
+warnings.warn("test", DeprecationWarning, source=None)
+warnings.warn("test", DeprecationWarning, source=None, stacklevel=2)
+warnings.warn("test", DeprecationWarning, stacklevel=1)
+warnings.warn("test", DeprecationWarning, 1)
+warnings.warn("test", category=DeprecationWarning, stacklevel=1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flake8-bugbear-23.3.23/tests/b033.py
new/flake8-bugbear-23.5.9/tests/b033.py
--- old/flake8-bugbear-23.3.23/tests/b033.py 1970-01-01 01:00:00.000000000
+0100
+++ new/flake8-bugbear-23.5.9/tests/b033.py 2023-05-10 01:57:52.000000000
+0200
@@ -0,0 +1,17 @@
+"""
+Should emit:
+B033 - on lines 6-12
+"""
+
+test = {1, 2, 3, 3, 5}
+test = {"a", "b", "c", "c", "e"}
+test = {True, False, True}
+test = {None, True, None}
+test = {3, 3.0}
+test = {1, True}
+test = {0, False}
+
+test = {1, 2, 3, 3.5, 5}
+test = {"a", "b", "c", "d", "e"}
+test = {True, False}
+test = {None}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flake8-bugbear-23.3.23/tests/b908.py
new/flake8-bugbear-23.5.9/tests/b908.py
--- old/flake8-bugbear-23.3.23/tests/b908.py 1970-01-01 01:00:00.000000000
+0100
+++ new/flake8-bugbear-23.5.9/tests/b908.py 2023-05-10 01:57:52.000000000
+0200
@@ -0,0 +1,57 @@
+import unittest
+import warnings
+
+import pytest
+from pytest import raises, warns
+
+with pytest.raises(TypeError):
+ a = 1 + "x"
+ b = "x" + 1
+print(a, b)
+
+
+class SomeTestCase(unittest.TestCase):
+ def test_func_raises(self):
+ with self.assertRaises(TypeError):
+ a = 1 + "x"
+ b = "x" + 1
+ print(a, b)
+
+ def test_func_raises_regex(self):
+ with self.assertRaisesRegex(TypeError):
+ a = 1 + "x"
+ b = "x" + 1
+ print(a, b)
+
+ def test_func_raises_regexp(self):
+ with self.assertRaisesRegexp(TypeError):
+ a = 1 + "x"
+ b = "x" + 1
+ print(a, b)
+
+ def test_raises_correct(self):
+ with self.assertRaises(TypeError):
+ print("1" + 1)
+
+
+with raises(Exception):
+ "1" + 1
+ "2" + 2
+
+with pytest.warns(Warning):
+ print("print before warning")
+ warnings.warn("some warning", stacklevel=1)
+
+with warns(Warning):
+ print("print before warning")
+ warnings.warn("some warning", stacklevel=1)
+
+# should not raise an error
+with pytest.raises(TypeError):
+ print("1" + 1)
+
+with pytest.warns(Warning):
+ warnings.warn("some warning", stacklevel=1)
+
+with raises(Exception):
+ raise Exception("some exception")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flake8-bugbear-23.3.23/tests/test_bugbear.py
new/flake8-bugbear-23.5.9/tests/test_bugbear.py
--- old/flake8-bugbear-23.3.23/tests/test_bugbear.py 2023-03-23
15:46:07.000000000 +0100
+++ new/flake8-bugbear-23.5.9/tests/test_bugbear.py 2023-05-10
01:57:52.000000000 +0200
@@ -44,6 +44,7 @@
B030,
B031,
B032,
+ B033,
B901,
B902,
B903,
@@ -51,6 +52,7 @@
B905,
B906,
B907,
+ B908,
B950,
BugBearChecker,
BugBearVisitor,
@@ -120,7 +122,7 @@
B006(72, 19),
B006(76, 31),
B006(80, 25),
- B006(85, 45 if sys.version_info >= (3, 8) else 46),
+ B006(85, 45),
B008(85, 60),
B006(89, 45),
B008(89, 63),
@@ -130,7 +132,7 @@
B008(109, 38),
B008(113, 11),
B008(113, 31),
- B008(117, 29 if sys.version_info >= (3, 8) else 30),
+ B008(117, 29),
B008(160, 29),
B008(164, 44),
B006(170, 19),
@@ -293,20 +295,17 @@
filename = Path(__file__).absolute().parent / "b019.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
-
- # AST Decorator column location for callable decorators changes in 3.7
- col = 5 if sys.version_info >= (3, 7) else 4
self.assertEqual(
errors,
self.errors(
B019(73, 5),
B019(77, 5),
- B019(81, col),
- B019(85, col),
+ B019(81, 5),
+ B019(85, 5),
B019(89, 5),
B019(93, 5),
- B019(97, col),
- B019(101, col),
+ B019(97, 5),
+ B019(101, 5),
),
)
@@ -430,7 +429,7 @@
B027(16, 4, vars=("empty_2",)),
B027(19, 4, vars=("empty_3",)),
B027(23, 4, vars=("empty_4",)),
- B027(31 if sys.version_info >= (3, 8) else 30, 4,
vars=("empty_5",)),
+ B027(31, 4, vars=("empty_5",)),
)
self.assertEqual(errors, expected)
@@ -489,7 +488,36 @@
)
self.assertEqual(errors, expected)
- @unittest.skipIf(sys.version_info < (3, 8), "not implemented for <3.8")
+ def test_b033(self):
+ filename = Path(__file__).absolute().parent / "b033.py"
+ bbc = BugBearChecker(filename=str(filename))
+ errors = list(bbc.run())
+ expected = self.errors(
+ B033(6, 7),
+ B033(7, 7),
+ B033(8, 7),
+ B033(9, 7),
+ B033(10, 7),
+ B033(11, 7),
+ B033(12, 7),
+ )
+ self.assertEqual(errors, expected)
+
+ def test_b908(self):
+ filename = Path(__file__).absolute().parent / "b908.py"
+ bbc = BugBearChecker(filename=str(filename))
+ errors = list(bbc.run())
+ expected = self.errors(
+ B908(7, 0),
+ B908(15, 8),
+ B908(21, 8),
+ B908(27, 8),
+ B908(37, 0),
+ B908(41, 0),
+ B908(45, 0),
+ )
+ self.assertEqual(errors, expected)
+
def test_b907(self):
filename = Path(__file__).absolute().parent / "b907.py"
bbc = BugBearChecker(filename=str(filename))
@@ -537,7 +565,6 @@
# manual permutations to save overhead when doing >60k permutations
# see format spec at
#
https://docs.python.org/3/library/string.html#format-specification-mini-language
- @unittest.skipIf(sys.version_info < (3, 8), "not implemented for <3.8")
def test_b907_format_specifier_permutations(self):
visitor = BugBearVisitor(filename="", lines="")
@@ -615,7 +642,6 @@
),
)
- @unittest.skipIf(sys.version_info < (3, 8), "requires 3.8+")
def test_b902_py38(self):
filename = Path(__file__).absolute().parent / "b902_py38.py"
bbc = BugBearChecker(filename=str(filename))