aboutsummaryrefslogtreecommitdiff
path: root/backend/tests/enwiki/test_gen_dump_index_db.py
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2023-01-21 12:21:03 +1100
committerTerry Truong <terry06890@gmail.com>2023-01-21 12:32:01 +1100
commit0a9b2c2e5eca8a04e37fbdd423379882863237c2 (patch)
tree1812bdb6bb13e4f76fdd7ef04075b291f775c213 /backend/tests/enwiki/test_gen_dump_index_db.py
parent8321e2f92dbc073b8f1de87895d6620a2021b22e (diff)
Adjust backend coding style
Increase line spacing, add section comments, etc
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 64053c4..5281911 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 hist_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())