aboutsummaryrefslogtreecommitdiff
path: root/backend/tests/enwiki/test_gen_dump_index_db.py
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2023-01-29 11:30:47 +1100
committerTerry Truong <terry06890@gmail.com>2023-01-29 11:30:47 +1100
commit8781fdb2b8c530a6c1531ae9e82221eb062e34fb (patch)
treeffd824aa9b945d69b47f012617ee13d98764d078 /backend/tests/enwiki/test_gen_dump_index_db.py
parentf5e87ae628bab0eef97b3e3e62f6d71cca9c99c0 (diff)
Adjust backend coding style
Add line spacing, section comments, and import consistency
Diffstat (limited to 'backend/tests/enwiki/test_gen_dump_index_db.py')
-rw-r--r--backend/tests/enwiki/test_gen_dump_index_db.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/backend/tests/enwiki/test_gen_dump_index_db.py b/backend/tests/enwiki/test_gen_dump_index_db.py
index e0715f3..b918f15 100644
--- a/backend/tests/enwiki/test_gen_dump_index_db.py
+++ b/backend/tests/enwiki/test_gen_dump_index_db.py
@@ -1,5 +1,6 @@
import unittest
-import tempfile, os
+import tempfile
+import os
from tests.common import createTestBz2, readTestDbTable
from tol_data.enwiki.gen_dump_index_db import genData
@@ -10,15 +11,18 @@ def runGenData(indexFileContents: str):
# Create temp index file
indexFile = os.path.join(tempDir, 'index.txt.bz2')
createTestBz2(indexFile, indexFileContents)
+
# Run
dbFile = os.path.join(tempDir, 'data.db')
genData(indexFile, dbFile)
+
# Read db
return readTestDbTable(dbFile, 'SELECT title, id, offset, next_offset FROM offsets')
class TestGenData(unittest.TestCase):
def setUp(self):
self.maxDiff = None # Remove output-diff size limit
+
def test_index_file(self):
indexFileContents = (
'100:10:apple\n'
@@ -33,6 +37,7 @@ class TestGenData(unittest.TestCase):
('banana ice-cream', 99, 300, 1000),
('Custard!', 2030, 1000, -1),
})
+
def test_emp_index(self):
offsetsMap = runGenData('')
self.assertEqual(offsetsMap, set())