]> ToastFreeware Gitweb - philipp/winterrodeln/wrfeed.git/blobdiff - tests/test_wrfeed.py
PEP 8 improvements.
[philipp/winterrodeln/wrfeed.git] / tests / test_wrfeed.py
index aed5896cb19ce8661e8ed52385f1fcec312b75d2..d4ccc5d945f71e6b956c675a977e63fb78637a59 100644 (file)
@@ -33,7 +33,8 @@ class TestDbWrfeed(WrfeedTestBase):
             # create database
             uri = make_url(wrfeed.app.config['SQLALCHEMY_DATABASE_URI'])
             self.uri = uri
-            uri_nodb = URL(uri.drivername, host=uri.host, port=uri.port, username=uri.username, password=uri.password, query=uri.query)
+            uri_nodb = URL(uri.drivername, host=uri.host, port=uri.port, username=uri.username,
+                           password=uri.password, query=uri.query)
             engine_nodb = sqlalchemy.create_engine(uri_nodb)
             engine_nodb.execute("DROP DATABASE IF EXISTS {}".format(uri.database))
             engine_nodb.execute("CREATE DATABASE {} CHARACTER SET = '{}'".format(uri.database, 'UTF8'))
@@ -50,9 +51,14 @@ class TestDbWrfeed(WrfeedTestBase):
             # update dates
             seconds_diff, = con.execute("SELECT TIMESTAMPDIFF(SECOND, '2017-03-31 07:00', now())").fetchone()
             seconds_diff = int(seconds_diff)
-            con.execute("UPDATE wrreport SET date_report = DATE(date_report + INTERVAL %s SECOND) WHERE time_report IS NULL", (seconds_diff,))
-            con.execute("UPDATE wrreport SET date_report = DATE(TIMESTAMP(date_report, time_report) + INTERVAL %s SECOND) WHERE time_report IS NOT NULL", (seconds_diff,))
-            con.execute("UPDATE wrreport SET time_report = TIME(TIMESTAMP(date_report, time_report) + INTERVAL %s SECOND) WHERE time_report IS NOT NULL", (seconds_diff,))
+            con.execute("UPDATE wrreport SET date_report = DATE(date_report + INTERVAL %s SECOND) "
+                        "WHERE time_report IS NULL", (seconds_diff,))
+            con.execute("UPDATE wrreport SET date_report = "
+                        "DATE(TIMESTAMP(date_report, time_report) + INTERVAL %s SECOND) "
+                        "WHERE time_report IS NOT NULL", (seconds_diff,))
+            con.execute("UPDATE wrreport SET time_report = "
+                        "TIME(TIMESTAMP(date_report, time_report) + INTERVAL %s SECOND) "
+                        "WHERE time_report IS NOT NULL", (seconds_diff,))
             con.execute("UPDATE wrreport SET date_entry = date_entry + INTERVAL %s SECOND", (seconds_diff,))
             con.execute("UPDATE wrreport SET date_invalid = date_invalid + INTERVAL %s SECOND", (seconds_diff,))
             con.execute("UPDATE wrreport SET delete_date = delete_date + INTERVAL %s SECOND", (seconds_diff,))
@@ -77,7 +83,8 @@ class TestDbWrfeed(WrfeedTestBase):
                 self.assertTrue(result.data.startswith(b'<?xml'))
                 root = et.fromstring(result.data)
                 self.assertIn('Rodelbahnberichte', root.find('{http://www.w3.org/2005/Atom}title').text)
-                self.assertEqual(len(root.findall('{http://www.w3.org/2005/Atom}entry')), count, '"{}" not found {} times'.format(bahn, count))
+                self.assertEqual(len(root.findall('{http://www.w3.org/2005/Atom}entry')), count,
+                                 '"{}" not found {} times'.format(bahn, count))
 
     def test_bahnen(self):
         bahnen_count = {
@@ -96,7 +103,8 @@ class TestDbWrfeed(WrfeedTestBase):
                 self.assertTrue(result.data.startswith(b'<?xml'))
                 root = et.fromstring(result.data)
                 self.assertIn('Rodelbahnberichte', root.find('{http://www.w3.org/2005/Atom}title').text)
-                self.assertEqual(len(root.findall('{http://www.w3.org/2005/Atom}entry')), count, 'bahnen "{}" not found {} times'.format(bahnen, count))
+                self.assertEqual(len(root.findall('{http://www.w3.org/2005/Atom}entry')), count,
+                                 f'bahnen "{bahnen}" not found {count} times')
 
     def test_region(self):
         region_count = {
@@ -110,4 +118,5 @@ class TestDbWrfeed(WrfeedTestBase):
                 self.assertTrue(result.data.startswith(b'<?xml'))
                 root = et.fromstring(result.data)
                 self.assertIn('Rodelbahnberichte', root.find('{http://www.w3.org/2005/Atom}title').text)
-                self.assertEqual(len(root.findall('{http://www.w3.org/2005/Atom}entry')), count, '"{}" not found {} times'.format(region, count))
+                self.assertEqual(len(root.findall('{http://www.w3.org/2005/Atom}entry')), count,
+                                 f'"{region}" not found {count} times')