Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2022-12-04 15:21:57 +0300
committerPhilipp Hörist <philipp@hoerist.com>2022-12-04 15:22:06 +0300
commit48a1b1ffbb1c071b5d5add9b17d78163bb8e1add (patch)
tree372b69889e88e4f6e999654984076c791bbd842d /test
parent38fd03ce6bb8463172891848194015981ab135b1 (diff)
cq: Tests: Fix ruff linter errors
Diffstat (limited to 'test')
-rw-r--r--test/gtk/change_password.py5
-rw-r--r--test/gtk/dataform.py10
-rw-r--r--test/gtk/fake_dataform.py5
-rw-r--r--test/gtk/groupchat_info.py4
-rw-r--r--test/gtk/util.py7
-rw-r--r--test/no_gui/test_styling.py14
-rw-r--r--test/no_gui/test_text_helpers.py2
7 files changed, 24 insertions, 23 deletions
diff --git a/test/gtk/change_password.py b/test/gtk/change_password.py
index d6451cad6..2934db454 100644
--- a/test/gtk/change_password.py
+++ b/test/gtk/change_password.py
@@ -26,14 +26,15 @@ app.get_client = MagicMock()
fields = [
create_field(typ='text-single', label='Username', var='username'),
create_field(typ='text-single', label='Old Password', var='old_password'),
- create_field(typ='text-single', label='Mothers name', var='mother', required=True),
+ create_field(typ='text-single', label='Mothers name',
+ var='mother', required=True),
]
form = SimpleDataForm(type_='form', fields=fields)
def _apply(self, next_stage=False):
if next_stage:
- print(self.get_page('next_stage').get_submit_form())
+ self.get_page('next_stage').get_submit_form()
else:
self.get_page('next_stage').set_form(form)
self.show_page('next_stage', Gtk.StackTransitionType.SLIDE_LEFT)
diff --git a/test/gtk/dataform.py b/test/gtk/dataform.py
index 2a517d3d5..38285be7d 100644
--- a/test/gtk/dataform.py
+++ b/test/gtk/dataform.py
@@ -44,9 +44,9 @@ uulhdcJGwA53+9ttkLFo0KR4wwPQ8q+tkl30we/A0AjPb9nT3egrnwEAJS7WrzJCTn/neAbN2orrAAMN
itner+hRS7W65wJLCJi6kp+XU1MORru7EvVkztO6ln3z4Nh123WLUNDjFUxvXaTcc6nMFcbfP1a9028z9gj2WIWqpqHu9QF/V7/CNxkeFYjA/llf+M3ulV5pdUduNZjoEtZtdLtL65vctPzc0SjmDE3uzL4XwEGaE59Wir0GODyhncVCiWBZ2GCfw2Y3y9MfwfzO5hO2
v8AIg7mWYx8/rwAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMDRUMjM6NTA6NDQrMDE6MDBAxMf7AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTA0VDIzOjUwOjQ0KzAxOjAwMZl/RwAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAoAAAAPAEAAAAAP
MLFTQAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAJiS0dEAAHdihOkAAAAB3RJTUUH4gsEFzIsqSs7CAAAABBJREFUGNNj+A8CDKMkjUkAKsYq5D2hXoMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtM
-TEtMDRUMjM6NTA6NDQrMDE6MDBAxMf7AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTA0VDIzOjUwOjQ0KzAxOjAwMZl/RwAAAABJRU5ErkJggg=='''
+TEtMDRUMjM6NTA6NDQrMDE6MDBAxMf7AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTA0VDIzOjUwOjQ0KzAxOjAwMZl/RwAAAABJRU5ErkJggg==''' # noqa
-app.bob_cache['sha1+8f35fef110ffc5df08d579a50083ff9308fb6242'] = b64decode(image)
+app.bob_cache['sha1+8f35fef110ffc5df08d579a50083ff9308fb6242'] = b64decode(image) # noqa
app.css_config = MagicMock()
app.css_config.get_value = MagicMock(return_value='rgb(100, 100, 255)')
@@ -118,12 +118,12 @@ FORM = '''
<required/>
</field>
</x>
-'''
+''' # noqa
class DataFormWindow(Gtk.Window):
def __init__(self):
- Gtk.Window.__init__(self, title="Data Form Test")
+ Gtk.Window.__init__(self, title='Data Form Test')
self.set_default_size(600, 600)
options = {
'left-width': 100,
@@ -135,6 +135,6 @@ class DataFormWindow(Gtk.Window):
self.show()
win = DataFormWindow()
-win.connect("destroy", Gtk.main_quit)
+win.connect('destroy', Gtk.main_quit)
win.show_all()
Gtk.main()
diff --git a/test/gtk/fake_dataform.py b/test/gtk/fake_dataform.py
index 1c3d2d2fb..30ceda1f3 100644
--- a/test/gtk/fake_dataform.py
+++ b/test/gtk/fake_dataform.py
@@ -14,7 +14,8 @@ util.load_style('gajim.css', CSSPriority.APPLICATION)
fake_form = {
- 'instructions': 'This is the a long long long long long long test instruction',
+ 'instructions': ('This is the a long long long long long '
+ 'long test instruction'),
'username': '',
'nick': '',
'password': '',
@@ -41,7 +42,7 @@ fake_form2 = {
class DataFormWindow(Gtk.Window):
def __init__(self):
- Gtk.Window.__init__(self, title="Data Form Test")
+ Gtk.Window.__init__(self, title='Data Form Test')
self.set_default_size(600, 600)
self._widget = FakeDataFormWidget(fake_form2)
self.add(self._widget)
diff --git a/test/gtk/groupchat_info.py b/test/gtk/groupchat_info.py
index 40a53a630..da156d755 100644
--- a/test/gtk/groupchat_info.py
+++ b/test/gtk/groupchat_info.py
@@ -1,7 +1,5 @@
from unittest.mock import MagicMock
-import time
-
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
@@ -88,7 +86,7 @@ stanza = Iq(node='''
</field>
</x>
</query>
-</iq>''')
+</iq>''') # noqa
subject = ('Lorem ipsum dolor sit amet, consetetur sadipscing elitr sed '
diff --git a/test/gtk/util.py b/test/gtk/util.py
index 06a949c5e..a6c2d0ca2 100644
--- a/test/gtk/util.py
+++ b/test/gtk/util.py
@@ -1,3 +1,4 @@
+import logging
from pathlib import Path
from gi.repository import Gdk
@@ -14,10 +15,10 @@ def get_gajim_dir() -> Path:
def load_style(filename: str, priority: CSSPriority) -> None:
path = get_gajim_dir() / 'data' / 'style' / filename
try:
- with open(str(path), 'r', encoding='utf8') as file:
+ with open(str(path), encoding='utf8') as file:
css = file.read()
- except Exception as exc:
- print(exc)
+ except Exception:
+ logging.exception('')
return
provider = Gtk.CssProvider()
provider.load_from_data(bytes(css.encode('utf-8')))
diff --git a/test/no_gui/test_styling.py b/test/no_gui/test_styling.py
index bef896350..86ba4c7f6 100644
--- a/test/no_gui/test_styling.py
+++ b/test/no_gui/test_styling.py
@@ -347,7 +347,7 @@ URIS = [
'http://مثال.إختبار',
'http://例子.测试',
'http://उदाहरण.परीक्षा',
- 'http://-.~_!$&\'()*+,;=:%40:80%2f::::::@example.com',
+ "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
'http://1337.net',
'http://a.b-c.de',
'http://223.255.255.254',
@@ -530,33 +530,33 @@ class Test(unittest.TestCase):
for uri in URIS:
text = self.wrap(uri)
hlinks = process_uris(text)
- self.assertEqual([l.uri for l in hlinks], [uri], text)
+ self.assertEqual([link.uri for link in hlinks], [uri], text)
def test_invalid_uris(self):
for foo in NONURIS + UNACCEPTABLE_URIS:
text = self.wrap(foo)
hlinks = process_uris(text)
- self.assertEqual([l.text for l in hlinks], [], text)
+ self.assertEqual([link.text for link in hlinks], [], text)
def test_jids(self):
for jid in JIDS:
text = self.wrap(jid)
uri = jid_to_iri(jid)
hlinks = process_uris(text)
- self.assertEqual([(l.text, l.uri) for l in hlinks],
+ self.assertEqual([(link.text, link.uri) for link in hlinks],
[(jid, uri)], text)
def test_nonjids(self):
for foo in NONJIDS:
text = self.wrap(foo)
hlinks = process_uris(text)
- self.assertEqual([l.text for l in hlinks], [], text)
+ self.assertEqual([link.text for link in hlinks], [], text)
def test_uris_with_text(self):
for text, results in URIS_WITH_TEXT:
hlinks = process_uris(text)
- self.assertEqual([l.text for l in hlinks], results, text)
+ self.assertEqual([link.text for link in hlinks], results, text)
-if __name__ == "__main__":
+if __name__ == '__main__':
unittest.main()
diff --git a/test/no_gui/test_text_helpers.py b/test/no_gui/test_text_helpers.py
index 5f3b0d995..86897829c 100644
--- a/test/no_gui/test_text_helpers.py
+++ b/test/no_gui/test_text_helpers.py
@@ -13,7 +13,7 @@ class Test(unittest.TestCase):
self.assertEqual(
escape_iri_path_segment(''.join(chr(c) for c in range(0x20,0x7F))),
- '%20!%22%23$%25&\'()*+,-.%2F0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMN'
+ "%20!%22%23$%25&'()*+,-.%2F0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMN"
'OPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~',
'ASCII printable')