Removing (object) subclassing from test classes

Old habit from python 2
This commit is contained in:
Bruno Oliveira 2015-04-04 12:05:44 -03:00
parent 8000ea33d2
commit 9128ac41cb
7 changed files with 58 additions and 58 deletions

View File

@ -80,7 +80,7 @@ def header_checker(caplog, stubs):
return _HeaderChecker(caplog, stubs) return _HeaderChecker(caplog, stubs)
class TestInline(object): class TestInline:
"""Various tests relating to the "inline" disposition type. """Various tests relating to the "inline" disposition type.
See Section 4.2 of RFC 6266. See Section 4.2 of RFC 6266.
@ -130,7 +130,7 @@ class TestInline(object):
expected_inline=True) expected_inline=True)
class TestAttachment(object): class TestAttachment:
"""Various tests relating to the "attachment" disposition type. """Various tests relating to the "attachment" disposition type.
See Section 4.2 of RFC 6266. See Section 4.2 of RFC 6266.
@ -620,7 +620,7 @@ class TestAttachment(object):
# Note we do not check the "Additional parameters" section. # Note we do not check the "Additional parameters" section.
class TestDispositionTypeExtension(object): class TestDispositionTypeExtension:
"""Tests checking behavior for disposition type extensions. """Tests checking behavior for disposition type extensions.
They should be treated as "attachment", see Section 4.2 of RFC 6266. They should be treated as "attachment", see Section 4.2 of RFC 6266.
@ -639,7 +639,7 @@ class TestDispositionTypeExtension(object):
'attachment; example="filename=example.txt"') 'attachment; example="filename=example.txt"')
class TestCharacterSet(object): class TestCharacterSet:
"""Various tests using the parameter value encoding defined in RFC 5987.""" """Various tests using the parameter value encoding defined in RFC 5987."""
def test_attwithisofn2231iso(self, header_checker): def test_attwithisofn2231iso(self, header_checker):
@ -815,7 +815,7 @@ class TestCharacterSet(object):
# Note we do not test the "RFC2231 Encoding: Continuations (optional)" section # Note we do not test the "RFC2231 Encoding: Continuations (optional)" section
class TestEncodingFallback(object): class TestEncodingFallback:
"""Test the same parameter both in traditional and extended format. """Test the same parameter both in traditional and extended format.
This tests how the UA behaves when the same parameter name appears This tests how the UA behaves when the same parameter name appears
@ -876,7 +876,7 @@ class TestEncodingFallback(object):
'foo.html') 'foo.html')
class TestRFC2047Encoding(object): class TestRFC2047Encoding:
"""These tests RFC 2047 style encoding. """These tests RFC 2047 style encoding.
Note that according to Section 5 of RFC 2047, this encoding does not apply Note that according to Section 5 of RFC 2047, this encoding does not apply
@ -911,7 +911,7 @@ class TestRFC2047Encoding(object):
'=?ISO-8859-1?Q?foo-=E4.html?=') '=?ISO-8859-1?Q?foo-=E4.html?=')
class TestOur(object): class TestOur:
"""Our own tests, not based on http://greenbytes.de/tech/tc2231/""" """Our own tests, not based on http://greenbytes.de/tech/tc2231/"""
def test_att_double_space(self, header_checker): def test_att_double_space(self, header_checker):

View File

@ -26,7 +26,7 @@ test_content_disposition.py file.
from qutebrowser.browser import http from qutebrowser.browser import http
class TestParseContentType(object): class TestParseContentType:
"""Test for parse_content_type.""" """Test for parse_content_type."""

View File

@ -27,7 +27,7 @@ from qutebrowser.browser.tabhistory import TabHistoryItem as Item
from qutebrowser.utils import qtutils from qutebrowser.utils import qtutils
class TestSerializeHistory(object): class TestSerializeHistory:
"""Tests for serialize().""" """Tests for serialize()."""
@ -102,7 +102,7 @@ class TestSerializeHistory(object):
assert self.history.itemAt(i).title() == item.title assert self.history.itemAt(i).title() == item.title
class TestSerializeHistorySpecial(object): class TestSerializeHistorySpecial:
"""Tests for serialize() without items set up in setUp.""" """Tests for serialize() without items set up in setUp."""

View File

@ -86,7 +86,7 @@ def get_webelem(geometry=None, frame=None, null=False, visibility='',
return wrapped return wrapped
class TestWebElementWrapper(object): class TestWebElementWrapper:
"""Test WebElementWrapper.""" """Test WebElementWrapper."""
@ -96,7 +96,7 @@ class TestWebElementWrapper(object):
get_webelem(null=True) get_webelem(null=True)
class TestIsVisibleInvalid(object): class TestIsVisibleInvalid:
"""Tests for is_visible with invalid elements. """Tests for is_visible with invalid elements.
@ -137,7 +137,7 @@ class TestIsVisibleInvalid(object):
assert elem.is_visible(self.frame) assert elem.is_visible(self.frame)
class TestIsVisibleScroll(object): class TestIsVisibleScroll:
"""Tests for is_visible when the frame is scrolled. """Tests for is_visible when the frame is scrolled.
@ -161,7 +161,7 @@ class TestIsVisibleScroll(object):
assert elem.is_visible(self.frame) assert elem.is_visible(self.frame)
class TestIsVisibleCss(object): class TestIsVisibleCss:
"""Tests for is_visible with CSS attributes. """Tests for is_visible with CSS attributes.
@ -196,7 +196,7 @@ class TestIsVisibleCss(object):
assert not elem.is_visible(self.frame) assert not elem.is_visible(self.frame)
class TestIsVisibleIframe(object): class TestIsVisibleIframe:
"""Tests for is_visible with a child frame. """Tests for is_visible with a child frame.
@ -276,7 +276,7 @@ class TestIsVisibleIframe(object):
assert self.elem4.is_visible(self.frame) assert self.elem4.is_visible(self.frame)
class TestIsWritable(object): class TestIsWritable:
"""Check is_writable.""" """Check is_writable."""
@ -296,7 +296,7 @@ class TestIsWritable(object):
assert not elem.is_writable() assert not elem.is_writable()
class TestJavascriptEscape(object): class TestJavascriptEscape:
"""Check javascript_escape. """Check javascript_escape.
@ -315,7 +315,7 @@ class TestJavascriptEscape(object):
assert webelem.javascript_escape(before) == after assert webelem.javascript_escape(before) == after
class TestGetChildFrames(object): class TestGetChildFrames:
"""Check get_child_frames.""" """Check get_child_frames."""
@ -366,7 +366,7 @@ class TestGetChildFrames(object):
frame.childFrames.assert_called_once_with() frame.childFrames.assert_called_once_with()
class TestIsEditable(object): class TestIsEditable:
"""Tests for is_editable.""" """Tests for is_editable."""

View File

@ -35,7 +35,7 @@ from qutebrowser.config import config, configexc
from qutebrowser.utils import objreg, standarddir from qutebrowser.utils import objreg, standarddir
class TestConfigParser(object): class TestConfigParser:
"""Test reading of ConfigParser.""" """Test reading of ConfigParser."""
@ -157,7 +157,7 @@ class TestConfigParser(object):
self.cfg.get('general', 'bar') # pylint: disable=bad-config-call self.cfg.get('general', 'bar') # pylint: disable=bad-config-call
class TestDefaultConfig(object): class TestDefaultConfig:
"""Test validating of the default config.""" """Test validating of the default config."""
@ -170,7 +170,7 @@ class TestDefaultConfig(object):
conf._validate_all() conf._validate_all()
class TestConfigInit(object): class TestConfigInit:
"""Test initializing of the config.""" """Test initializing of the config."""

View File

@ -73,7 +73,7 @@ def os_path(mocker):
return mocker.patch('qutebrowser.config.configtypes.os.path', autospec=True) return mocker.patch('qutebrowser.config.configtypes.os.path', autospec=True)
class TestValidValues(object): class TestValidValues:
"""Test ValidValues.""" """Test ValidValues."""
def test_contains_without_desc(self): def test_contains_without_desc(self):
@ -120,7 +120,7 @@ class TestValidValues(object):
assert 'baz' not in vv.descriptions assert 'baz' not in vv.descriptions
class TestBaseType(object): class TestBaseType:
"""Test BaseType.""" """Test BaseType."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -174,7 +174,7 @@ class TestBaseType(object):
assert self.t.complete() == [('foo', "foo desc"), ('bar', "")] assert self.t.complete() == [('foo', "foo desc"), ('bar', "")]
class TestString(object): class TestString:
"""Test String.""" """Test String."""
def test_minlen_toosmall(self): def test_minlen_toosmall(self):
@ -268,7 +268,7 @@ class TestString(object):
assert t.transform('foobar') == 'foobar' assert t.transform('foobar') == 'foobar'
class TestList(object): class TestList:
"""Test List.""" """Test List."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -317,7 +317,7 @@ class TestList(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestBool(object): class TestBool:
"""Test Bool.""" """Test Bool."""
TESTS = {True: ['1', 'yes', 'YES', 'true', 'TrUe', 'on'], TESTS = {True: ['1', 'yes', 'YES', 'true', 'TrUe', 'on'],
@ -366,7 +366,7 @@ class TestBool(object):
t.validate('') t.validate('')
class TestInt(object): class TestInt:
"""Test Int.""" """Test Int."""
def test_minval_gt_maxval(self): def test_minval_gt_maxval(self):
@ -443,7 +443,7 @@ class TestInt(object):
assert t.transform('1337') == 1337 assert t.transform('1337') == 1337
class TestIntList(object): class TestIntList:
"""Test IntList.""" """Test IntList."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -482,7 +482,7 @@ class TestIntList(object):
assert self.t.transform('23,,42'), [23, None == 42] assert self.t.transform('23,,42'), [23, None == 42]
class TestFloat(object): class TestFloat:
"""Test Float.""" """Test Float."""
def test_minval_gt_maxval(self): def test_minval_gt_maxval(self):
@ -569,7 +569,7 @@ class TestFloat(object):
assert t.transform('1337') == 1337.00 assert t.transform('1337') == 1337.00
class TestPerc(object): class TestPerc:
"""Test Perc.""" """Test Perc."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -650,7 +650,7 @@ class TestPerc(object):
assert self.t.transform('1337%') == 1337 assert self.t.transform('1337%') == 1337
class TestPercList(object): class TestPercList:
"""Test PercList.""" """Test PercList."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -730,7 +730,7 @@ class TestPercList(object):
assert self.t.transform('23%,,42%'), [23, None == 42] assert self.t.transform('23%,,42%'), [23, None == 42]
class TestPercOrInt(object): class TestPercOrInt:
"""Test PercOrInt.""" """Test PercOrInt."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -867,7 +867,7 @@ class TestPercOrInt(object):
assert self.t.transform('1337') == '1337' assert self.t.transform('1337') == '1337'
class TestCommand(object): class TestCommand:
"""Test Command.""" """Test Command."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -923,7 +923,7 @@ class TestCommand(object):
assert ('cmd2', "desc 2") in items assert ('cmd2', "desc 2") in items
class TestColorSystem(object): class TestColorSystem:
"""Test ColorSystem.""" """Test ColorSystem."""
TESTS = { TESTS = {
@ -971,7 +971,7 @@ class TestColorSystem(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestQtColor(object): class TestQtColor:
"""Test QtColor.""" """Test QtColor."""
VALID = ['#123', '#112233', '#111222333', '#111122223333', 'red'] VALID = ['#123', '#112233', '#111222333', '#111122223333', 'red']
@ -1083,7 +1083,7 @@ FontDesc = collections.namedtuple('FontDesc',
['style', 'weight', 'pt', 'px', 'family']) ['style', 'weight', 'pt', 'px', 'family'])
class TestFont(object): class TestFont:
"""Test Font/QtFont.""" """Test Font/QtFont."""
TESTS = { TESTS = {
@ -1182,7 +1182,7 @@ class TestFont(object):
assert self.t2.transform('') is None assert self.t2.transform('') is None
class TestFontFamily(object): class TestFontFamily:
"""Test FontFamily.""" """Test FontFamily."""
TESTS = ['"Foobar Neue"', 'inconsolatazi4', 'Foobar'] TESTS = ['"Foobar Neue"', 'inconsolatazi4', 'Foobar']
@ -1233,7 +1233,7 @@ class TestFontFamily(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestRegex(object): class TestRegex:
"""Test Regex.""" """Test Regex."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1268,7 +1268,7 @@ class TestRegex(object):
assert self.t.transform(r'foobar') == re.compile(r'foobar') assert self.t.transform(r'foobar') == re.compile(r'foobar')
class TestRegexList(object): class TestRegexList:
"""Test RegexList.""" """Test RegexList."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1309,7 +1309,7 @@ class TestRegexList(object):
assert self.t.transform('foo,,bar') == expected assert self.t.transform('foo,,bar') == expected
class TestFile(object): class TestFile:
"""Test File.""" """Test File."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1375,7 +1375,7 @@ class TestFile(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestDirectory(object): class TestDirectory:
"""Test Directory.""" """Test Directory."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1453,7 +1453,7 @@ class TestDirectory(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestWebKitByte(object): class TestWebKitByte:
"""Test WebKitBytes.""" """Test WebKitBytes."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1527,7 +1527,7 @@ class TestWebKitByte(object):
assert self.t.transform('1k') == 1024 assert self.t.transform('1k') == 1024
class TestWebKitBytesList(object): class TestWebKitBytesList:
"""Test WebKitBytesList.""" """Test WebKitBytesList."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1598,7 +1598,7 @@ class TestWebKitBytesList(object):
assert self.t.transform('23,,42'), [23, None == 42] assert self.t.transform('23,,42'), [23, None == 42]
class TestShellCommand(object): class TestShellCommand:
"""Test ShellCommand.""" """Test ShellCommand."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1648,7 +1648,7 @@ class TestShellCommand(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestProxy(object): class TestProxy:
"""Test Proxy.""" """Test Proxy."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1757,7 +1757,7 @@ class TestProxy(object):
assert proxy == val assert proxy == val
class TestSearchEngineName(object): class TestSearchEngineName:
"""Test SearchEngineName.""" """Test SearchEngineName."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1783,7 +1783,7 @@ class TestSearchEngineName(object):
assert self.t.transform("foobar") == "foobar" assert self.t.transform("foobar") == "foobar"
class TestSearchEngineUrl(object): class TestSearchEngineUrl:
"""Test SearchEngineUrl.""" """Test SearchEngineUrl."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1823,7 +1823,7 @@ class TestSearchEngineUrl(object):
assert self.t.transform("foobar") == "foobar" assert self.t.transform("foobar") == "foobar"
class TestFuzzyUrl(object): class TestFuzzyUrl:
"""Test FuzzyUrl.""" """Test FuzzyUrl."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1867,7 +1867,7 @@ class TestFuzzyUrl(object):
assert self.t.transform("example.com") == QUrl('http://example.com') assert self.t.transform("example.com") == QUrl('http://example.com')
class TestUserStyleSheet(object): class TestUserStyleSheet:
"""Test UserStyleSheet.""" """Test UserStyleSheet."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -1905,7 +1905,7 @@ class TestUserStyleSheet(object):
assert self.t.transform("test") == url assert self.t.transform("test") == url
class TestAutoSearch(object): class TestAutoSearch:
"""Test AutoSearch.""" """Test AutoSearch."""
TESTS = { TESTS = {
@ -1955,7 +1955,7 @@ class TestAutoSearch(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestIgnoreCase(object): class TestIgnoreCase:
"""Test IgnoreCase.""" """Test IgnoreCase."""
TESTS = { TESTS = {
@ -2005,7 +2005,7 @@ class TestIgnoreCase(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestEncoding(object): class TestEncoding:
"""Test Encoding.""" """Test Encoding."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -2041,7 +2041,7 @@ class TestEncoding(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestUrlList(object): class TestUrlList:
"""Test UrlList.""" """Test UrlList."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -2093,7 +2093,7 @@ class TestUrlList(object):
assert self.t.transform('') is None assert self.t.transform('') is None
class TestFormatString(object): class TestFormatString:
"""Test FormatString.""" """Test FormatString."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -2133,7 +2133,7 @@ class TestFormatString(object):
t.validate('') t.validate('')
class TestUserAgent(object): class TestUserAgent:
"""Test UserAgent.""" """Test UserAgent."""
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)

View File

@ -43,7 +43,7 @@ def change_qapp_name():
@pytest.mark.skipif(not sys.platform.startswith("linux"), @pytest.mark.skipif(not sys.platform.startswith("linux"),
reason="requires Linux") reason="requires Linux")
class TestGetStandardDirLinux(object): class TestGetStandardDirLinux:
"""Tests for standarddir under Linux. """Tests for standarddir under Linux.
""" """
@ -92,7 +92,7 @@ class TestGetStandardDirLinux(object):
@pytest.mark.skipif(not sys.platform.startswith("win"), @pytest.mark.skipif(not sys.platform.startswith("win"),
reason="requires Windows") reason="requires Windows")
class TestGetStandardDirWindows(object): class TestGetStandardDirWindows:
"""Tests for standarddir under Windows. """Tests for standarddir under Windows.
""" """