diff --git a/cssutils/css/value.py b/cssutils/css/value.py index fc69d61c..438b0f2b 100644 --- a/cssutils/css/value.py +++ b/cssutils/css/value.py @@ -314,7 +314,6 @@ class ColorValue(Value): from .colors import COLORS - type = Value.COLOR_VALUE # hexcolor, FUNCTION? _colorType = None _red = 0 diff --git a/cssutils/tests/test_cssstyledeclaration.py b/cssutils/tests/test_cssstyledeclaration.py index 4860f4f6..aa9c3f08 100644 --- a/cssutils/tests/test_cssstyledeclaration.py +++ b/cssutils/tests/test_cssstyledeclaration.py @@ -81,9 +81,7 @@ def test__iter__item(self): border: 0; ''' # __iter__ - ps = [] - for p in s: - ps.append((p.literalname, p.value, p.priority)) + ps = [(p.literalname, p.value, p.priority) for p in s] assert len(ps) == 3 assert ps[0] == (r'co\lor', 'green', '') assert ps[1] == (r'left', '1px', 'important') @@ -184,7 +182,7 @@ def test_children(self): def t(s): for i, x in enumerate(s.children()): - assert types[i] == type(x) + assert isinstance(x, types[i]) assert x.parent == s t(cssutils.parseStyle(style)) diff --git a/cssutils/tests/test_cssvalue.py b/cssutils/tests/test_cssvalue.py index 5dbb0c5a..1b527d6c 100644 --- a/cssutils/tests/test_cssvalue.py +++ b/cssutils/tests/test_cssvalue.py @@ -331,7 +331,7 @@ def test_cssValueType(self): assert value == v.cssText assert name == v.cssValueTypeString assert getattr(v, name) == v.cssValueType - assert cls == type(v) + assert isinstance(v, cls) def test_readonly(self): "(CSSValue._readonly)" @@ -636,7 +636,7 @@ def test_setFloat(self): initialType, initialValue = test pv = cssutils.css.CSSPrimitiveValue(initialValue) for setType, setValue, exp, cssText in tests[test]: - if type(exp) == type or type(exp) == type: # 2.4 compatibility + if isinstance(exp, type): if cssText: with pytest.raises(exp, match=cssText): pv.setFloatValue(setType, setValue) diff --git a/cssutils/tests/test_cssvariablesdeclaration.py b/cssutils/tests/test_cssvariablesdeclaration.py index 826f25c1..e1d91957 100644 --- a/cssutils/tests/test_cssvariablesdeclaration.py +++ b/cssutils/tests/test_cssvariablesdeclaration.py @@ -64,10 +64,8 @@ def test_items(self): assert 0 == v.length v.cssText = 'x:0; y:1' - keys = [] # unsorted! - for i in range(0, v.length): - keys.append(v.item(i)) + keys = [v.item(i) for i in range(0, v.length)] assert sorted(keys) == ['x', 'y'] def test_keys(self): diff --git a/cssutils/tests/test_value.py b/cssutils/tests/test_value.py index 6cd0c999..a808881c 100644 --- a/cssutils/tests/test_value.py +++ b/cssutils/tests/test_value.py @@ -776,7 +776,7 @@ def test_cssValueType(self): assert value == v.cssText assert name == v.cssValueTypeString assert getattr(v, name) == v.cssValueType - assert cls == type(v) + assert isinstance(v, cls) @pytest.mark.xfail(reason="not implemented")