1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-22 22:48:51 +02:00

Modernize code with pyupgrade

pyupgrade --keep-percent-format --py36-plus `find -name '*.py'`
This commit is contained in:
2022-07-28 19:11:29 +02:00
parent e7af9cebb3
commit feb53212dd
38 changed files with 126 additions and 138 deletions

View File

@@ -11,7 +11,7 @@ FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'request_fixtures')
def suite():
import unittest
return unittest.makeSuite(TestRequest)
return unittest.defaultTestLoader.loadTestsFromTestCase(TestRequest)
class TestRequest(OscTestCase):
def _get_fixtures_dir(self):
@@ -322,7 +322,7 @@ class TestRequest(OscTestCase):
def test_read_request1(self):
"""read in a request"""
xml = open(os.path.join(self._get_fixtures_dir(), 'test_read_request1.xml'), 'r').read().strip()
xml = open(os.path.join(self._get_fixtures_dir(), 'test_read_request1.xml')).read().strip()
r = osc.core.Request()
r.read(ET.fromstring(xml))
self.assertEqual(r.reqid, '42')
@@ -353,7 +353,7 @@ class TestRequest(OscTestCase):
def test_read_request2(self):
"""read in a request (with reviews)"""
xml = open(os.path.join(self._get_fixtures_dir(), 'test_read_request2.xml'), 'r').read().strip()
xml = open(os.path.join(self._get_fixtures_dir(), 'test_read_request2.xml')).read().strip()
r = osc.core.Request()
r.read(ET.fromstring(xml))
self.assertEqual(r.reqid, '123')
@@ -427,7 +427,7 @@ class TestRequest(OscTestCase):
def test_request_list_view1(self):
"""test the list_view method"""
xml = open(os.path.join(self._get_fixtures_dir(), 'test_request_list_view1.xml'), 'r').read().strip()
xml = open(os.path.join(self._get_fixtures_dir(), 'test_request_list_view1.xml')).read().strip()
exp = """\
62 State:new By:Admin When:2010-12-29T14:57:25
set_bugowner: buguser foo
@@ -444,7 +444,7 @@ class TestRequest(OscTestCase):
def test_request_list_view2(self):
"""test the list_view method (with history elements and description)"""
xml = open(os.path.join(self._get_fixtures_dir(), 'test_request_list_view2.xml'), 'r').read().strip()
xml = open(os.path.join(self._get_fixtures_dir(), 'test_request_list_view2.xml')).read().strip()
r = osc.core.Request()
r.read(ET.fromstring(xml))
exp = """\
@@ -458,7 +458,7 @@ class TestRequest(OscTestCase):
def test_request_str1(self):
"""test the __str__ method"""
xml = open(os.path.join(self._get_fixtures_dir(), 'test_request_str1.xml'), 'r').read().strip()
xml = open(os.path.join(self._get_fixtures_dir(), 'test_request_str1.xml')).read().strip()
r = osc.core.Request()
r = osc.core.Request()
r.read(ET.fromstring(xml))
@@ -555,7 +555,7 @@ Comment: <no comment>"""
def test_get_actions(self):
"""test get_actions method"""
xml = open(os.path.join(self._get_fixtures_dir(), 'test_request_list_view1.xml'), 'r').read().strip()
xml = open(os.path.join(self._get_fixtures_dir(), 'test_request_list_view1.xml')).read().strip()
r = osc.core.Request()
r.read(ET.fromstring(xml))
sr_actions = r.get_actions('submit')