From 9128ac41cb6c992fce018f4f1eb0b5b5dba60930 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 4 Apr 2015 12:05:44 -0300 Subject: [PATCH] Removing (object) subclassing from test classes Old habit from python 2 --- test/browser/http/test_content_disposition.py | 14 ++-- test/browser/http/test_http.py | 2 +- test/browser/test_tabhistory.py | 4 +- test/browser/test_webelem.py | 18 ++--- test/config/test_config.py | 6 +- test/config/test_configtypes.py | 68 +++++++++---------- test/utils/test_standarddir.py | 4 +- 7 files changed, 58 insertions(+), 58 deletions(-) diff --git a/test/browser/http/test_content_disposition.py b/test/browser/http/test_content_disposition.py index af8ac8892..24f387250 100644 --- a/test/browser/http/test_content_disposition.py +++ b/test/browser/http/test_content_disposition.py @@ -80,7 +80,7 @@ def header_checker(caplog, stubs): return _HeaderChecker(caplog, stubs) -class TestInline(object): +class TestInline: """Various tests relating to the "inline" disposition type. See Section 4.2 of RFC 6266. @@ -130,7 +130,7 @@ class TestInline(object): expected_inline=True) -class TestAttachment(object): +class TestAttachment: """Various tests relating to the "attachment" disposition type. See Section 4.2 of RFC 6266. @@ -620,7 +620,7 @@ class TestAttachment(object): # Note we do not check the "Additional parameters" section. -class TestDispositionTypeExtension(object): +class TestDispositionTypeExtension: """Tests checking behavior for disposition type extensions. 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"') -class TestCharacterSet(object): +class TestCharacterSet: """Various tests using the parameter value encoding defined in RFC 5987.""" def test_attwithisofn2231iso(self, header_checker): @@ -815,7 +815,7 @@ class TestCharacterSet(object): # 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. This tests how the UA behaves when the same parameter name appears @@ -876,7 +876,7 @@ class TestEncodingFallback(object): 'foo.html') -class TestRFC2047Encoding(object): +class TestRFC2047Encoding: """These tests RFC 2047 style encoding. 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?=') -class TestOur(object): +class TestOur: """Our own tests, not based on http://greenbytes.de/tech/tc2231/""" def test_att_double_space(self, header_checker): diff --git a/test/browser/http/test_http.py b/test/browser/http/test_http.py index 9b40f0b65..152f94ea6 100644 --- a/test/browser/http/test_http.py +++ b/test/browser/http/test_http.py @@ -26,7 +26,7 @@ test_content_disposition.py file. from qutebrowser.browser import http -class TestParseContentType(object): +class TestParseContentType: """Test for parse_content_type.""" diff --git a/test/browser/test_tabhistory.py b/test/browser/test_tabhistory.py index aebbb7259..3b7f7b170 100644 --- a/test/browser/test_tabhistory.py +++ b/test/browser/test_tabhistory.py @@ -27,7 +27,7 @@ from qutebrowser.browser.tabhistory import TabHistoryItem as Item from qutebrowser.utils import qtutils -class TestSerializeHistory(object): +class TestSerializeHistory: """Tests for serialize().""" @@ -102,7 +102,7 @@ class TestSerializeHistory(object): assert self.history.itemAt(i).title() == item.title -class TestSerializeHistorySpecial(object): +class TestSerializeHistorySpecial: """Tests for serialize() without items set up in setUp.""" diff --git a/test/browser/test_webelem.py b/test/browser/test_webelem.py index 54c1ba051..6bba4ad42 100644 --- a/test/browser/test_webelem.py +++ b/test/browser/test_webelem.py @@ -86,7 +86,7 @@ def get_webelem(geometry=None, frame=None, null=False, visibility='', return wrapped -class TestWebElementWrapper(object): +class TestWebElementWrapper: """Test WebElementWrapper.""" @@ -96,7 +96,7 @@ class TestWebElementWrapper(object): get_webelem(null=True) -class TestIsVisibleInvalid(object): +class TestIsVisibleInvalid: """Tests for is_visible with invalid elements. @@ -137,7 +137,7 @@ class TestIsVisibleInvalid(object): assert elem.is_visible(self.frame) -class TestIsVisibleScroll(object): +class TestIsVisibleScroll: """Tests for is_visible when the frame is scrolled. @@ -161,7 +161,7 @@ class TestIsVisibleScroll(object): assert elem.is_visible(self.frame) -class TestIsVisibleCss(object): +class TestIsVisibleCss: """Tests for is_visible with CSS attributes. @@ -196,7 +196,7 @@ class TestIsVisibleCss(object): assert not elem.is_visible(self.frame) -class TestIsVisibleIframe(object): +class TestIsVisibleIframe: """Tests for is_visible with a child frame. @@ -276,7 +276,7 @@ class TestIsVisibleIframe(object): assert self.elem4.is_visible(self.frame) -class TestIsWritable(object): +class TestIsWritable: """Check is_writable.""" @@ -296,7 +296,7 @@ class TestIsWritable(object): assert not elem.is_writable() -class TestJavascriptEscape(object): +class TestJavascriptEscape: """Check javascript_escape. @@ -315,7 +315,7 @@ class TestJavascriptEscape(object): assert webelem.javascript_escape(before) == after -class TestGetChildFrames(object): +class TestGetChildFrames: """Check get_child_frames.""" @@ -366,7 +366,7 @@ class TestGetChildFrames(object): frame.childFrames.assert_called_once_with() -class TestIsEditable(object): +class TestIsEditable: """Tests for is_editable.""" diff --git a/test/config/test_config.py b/test/config/test_config.py index 465cd10ad..eda492a26 100644 --- a/test/config/test_config.py +++ b/test/config/test_config.py @@ -35,7 +35,7 @@ from qutebrowser.config import config, configexc from qutebrowser.utils import objreg, standarddir -class TestConfigParser(object): +class TestConfigParser: """Test reading of ConfigParser.""" @@ -157,7 +157,7 @@ class TestConfigParser(object): self.cfg.get('general', 'bar') # pylint: disable=bad-config-call -class TestDefaultConfig(object): +class TestDefaultConfig: """Test validating of the default config.""" @@ -170,7 +170,7 @@ class TestDefaultConfig(object): conf._validate_all() -class TestConfigInit(object): +class TestConfigInit: """Test initializing of the config.""" diff --git a/test/config/test_configtypes.py b/test/config/test_configtypes.py index af887774a..da2597602 100644 --- a/test/config/test_configtypes.py +++ b/test/config/test_configtypes.py @@ -73,7 +73,7 @@ def os_path(mocker): return mocker.patch('qutebrowser.config.configtypes.os.path', autospec=True) -class TestValidValues(object): +class TestValidValues: """Test ValidValues.""" def test_contains_without_desc(self): @@ -120,7 +120,7 @@ class TestValidValues(object): assert 'baz' not in vv.descriptions -class TestBaseType(object): +class TestBaseType: """Test BaseType.""" @pytest.fixture(autouse=True) @@ -174,7 +174,7 @@ class TestBaseType(object): assert self.t.complete() == [('foo', "foo desc"), ('bar', "")] -class TestString(object): +class TestString: """Test String.""" def test_minlen_toosmall(self): @@ -268,7 +268,7 @@ class TestString(object): assert t.transform('foobar') == 'foobar' -class TestList(object): +class TestList: """Test List.""" @pytest.fixture(autouse=True) @@ -317,7 +317,7 @@ class TestList(object): assert self.t.transform('') is None -class TestBool(object): +class TestBool: """Test Bool.""" TESTS = {True: ['1', 'yes', 'YES', 'true', 'TrUe', 'on'], @@ -366,7 +366,7 @@ class TestBool(object): t.validate('') -class TestInt(object): +class TestInt: """Test Int.""" def test_minval_gt_maxval(self): @@ -443,7 +443,7 @@ class TestInt(object): assert t.transform('1337') == 1337 -class TestIntList(object): +class TestIntList: """Test IntList.""" @pytest.fixture(autouse=True) @@ -482,7 +482,7 @@ class TestIntList(object): assert self.t.transform('23,,42'), [23, None == 42] -class TestFloat(object): +class TestFloat: """Test Float.""" def test_minval_gt_maxval(self): @@ -569,7 +569,7 @@ class TestFloat(object): assert t.transform('1337') == 1337.00 -class TestPerc(object): +class TestPerc: """Test Perc.""" @pytest.fixture(autouse=True) @@ -650,7 +650,7 @@ class TestPerc(object): assert self.t.transform('1337%') == 1337 -class TestPercList(object): +class TestPercList: """Test PercList.""" @pytest.fixture(autouse=True) @@ -730,7 +730,7 @@ class TestPercList(object): assert self.t.transform('23%,,42%'), [23, None == 42] -class TestPercOrInt(object): +class TestPercOrInt: """Test PercOrInt.""" @pytest.fixture(autouse=True) @@ -867,7 +867,7 @@ class TestPercOrInt(object): assert self.t.transform('1337') == '1337' -class TestCommand(object): +class TestCommand: """Test Command.""" @pytest.fixture(autouse=True) @@ -923,7 +923,7 @@ class TestCommand(object): assert ('cmd2', "desc 2") in items -class TestColorSystem(object): +class TestColorSystem: """Test ColorSystem.""" TESTS = { @@ -971,7 +971,7 @@ class TestColorSystem(object): assert self.t.transform('') is None -class TestQtColor(object): +class TestQtColor: """Test QtColor.""" VALID = ['#123', '#112233', '#111222333', '#111122223333', 'red'] @@ -1083,7 +1083,7 @@ FontDesc = collections.namedtuple('FontDesc', ['style', 'weight', 'pt', 'px', 'family']) -class TestFont(object): +class TestFont: """Test Font/QtFont.""" TESTS = { @@ -1182,7 +1182,7 @@ class TestFont(object): assert self.t2.transform('') is None -class TestFontFamily(object): +class TestFontFamily: """Test FontFamily.""" TESTS = ['"Foobar Neue"', 'inconsolatazi4', 'Foobar'] @@ -1233,7 +1233,7 @@ class TestFontFamily(object): assert self.t.transform('') is None -class TestRegex(object): +class TestRegex: """Test Regex.""" @pytest.fixture(autouse=True) @@ -1268,7 +1268,7 @@ class TestRegex(object): assert self.t.transform(r'foobar') == re.compile(r'foobar') -class TestRegexList(object): +class TestRegexList: """Test RegexList.""" @pytest.fixture(autouse=True) @@ -1309,7 +1309,7 @@ class TestRegexList(object): assert self.t.transform('foo,,bar') == expected -class TestFile(object): +class TestFile: """Test File.""" @pytest.fixture(autouse=True) @@ -1375,7 +1375,7 @@ class TestFile(object): assert self.t.transform('') is None -class TestDirectory(object): +class TestDirectory: """Test Directory.""" @pytest.fixture(autouse=True) @@ -1453,7 +1453,7 @@ class TestDirectory(object): assert self.t.transform('') is None -class TestWebKitByte(object): +class TestWebKitByte: """Test WebKitBytes.""" @pytest.fixture(autouse=True) @@ -1527,7 +1527,7 @@ class TestWebKitByte(object): assert self.t.transform('1k') == 1024 -class TestWebKitBytesList(object): +class TestWebKitBytesList: """Test WebKitBytesList.""" @pytest.fixture(autouse=True) @@ -1598,7 +1598,7 @@ class TestWebKitBytesList(object): assert self.t.transform('23,,42'), [23, None == 42] -class TestShellCommand(object): +class TestShellCommand: """Test ShellCommand.""" @pytest.fixture(autouse=True) @@ -1648,7 +1648,7 @@ class TestShellCommand(object): assert self.t.transform('') is None -class TestProxy(object): +class TestProxy: """Test Proxy.""" @pytest.fixture(autouse=True) @@ -1757,7 +1757,7 @@ class TestProxy(object): assert proxy == val -class TestSearchEngineName(object): +class TestSearchEngineName: """Test SearchEngineName.""" @pytest.fixture(autouse=True) @@ -1783,7 +1783,7 @@ class TestSearchEngineName(object): assert self.t.transform("foobar") == "foobar" -class TestSearchEngineUrl(object): +class TestSearchEngineUrl: """Test SearchEngineUrl.""" @pytest.fixture(autouse=True) @@ -1823,7 +1823,7 @@ class TestSearchEngineUrl(object): assert self.t.transform("foobar") == "foobar" -class TestFuzzyUrl(object): +class TestFuzzyUrl: """Test FuzzyUrl.""" @pytest.fixture(autouse=True) @@ -1867,7 +1867,7 @@ class TestFuzzyUrl(object): assert self.t.transform("example.com") == QUrl('http://example.com') -class TestUserStyleSheet(object): +class TestUserStyleSheet: """Test UserStyleSheet.""" @pytest.fixture(autouse=True) @@ -1905,7 +1905,7 @@ class TestUserStyleSheet(object): assert self.t.transform("test") == url -class TestAutoSearch(object): +class TestAutoSearch: """Test AutoSearch.""" TESTS = { @@ -1955,7 +1955,7 @@ class TestAutoSearch(object): assert self.t.transform('') is None -class TestIgnoreCase(object): +class TestIgnoreCase: """Test IgnoreCase.""" TESTS = { @@ -2005,7 +2005,7 @@ class TestIgnoreCase(object): assert self.t.transform('') is None -class TestEncoding(object): +class TestEncoding: """Test Encoding.""" @pytest.fixture(autouse=True) @@ -2041,7 +2041,7 @@ class TestEncoding(object): assert self.t.transform('') is None -class TestUrlList(object): +class TestUrlList: """Test UrlList.""" @pytest.fixture(autouse=True) @@ -2093,7 +2093,7 @@ class TestUrlList(object): assert self.t.transform('') is None -class TestFormatString(object): +class TestFormatString: """Test FormatString.""" @pytest.fixture(autouse=True) @@ -2133,7 +2133,7 @@ class TestFormatString(object): t.validate('') -class TestUserAgent(object): +class TestUserAgent: """Test UserAgent.""" @pytest.fixture(autouse=True) diff --git a/test/utils/test_standarddir.py b/test/utils/test_standarddir.py index e80b38015..c69210cc4 100644 --- a/test/utils/test_standarddir.py +++ b/test/utils/test_standarddir.py @@ -43,7 +43,7 @@ def change_qapp_name(): @pytest.mark.skipif(not sys.platform.startswith("linux"), reason="requires Linux") -class TestGetStandardDirLinux(object): +class TestGetStandardDirLinux: """Tests for standarddir under Linux. """ @@ -92,7 +92,7 @@ class TestGetStandardDirLinux(object): @pytest.mark.skipif(not sys.platform.startswith("win"), reason="requires Windows") -class TestGetStandardDirWindows(object): +class TestGetStandardDirWindows: """Tests for standarddir under Windows. """