mirror of
https://github.com/neuml/txtai.git
synced 2026-10-12 02:19:52 +00:00
Merge pull request #1333 from HuaTNA/fix-tabular-falsy-idcolumn
Respect explicitly selected falsy ID column names in Tabular
This commit is contained in:
@@ -157,6 +157,16 @@ class TestTabular(unittest.TestCase):
|
||||
|
||||
self.assertIsNone(data["metadata"])
|
||||
|
||||
def testFalsyIDColumn(self):
|
||||
"""
|
||||
Explicit column labels are used for IDs and excluded from default text.
|
||||
"""
|
||||
|
||||
for column in ("", 0, "id"):
|
||||
with self.subTest(column=column):
|
||||
rows = Tabular(idcolumn=column)([{column: "doc-7", "text": "hello"}])
|
||||
self.assertEqual(rows, [("doc-7", "hello", None)])
|
||||
|
||||
def testNoColumns(self):
|
||||
"""
|
||||
Test creating text without specifying columns
|
||||
|
||||
Reference in New Issue
Block a user