Skip to content

Commit 33d3622

Browse files
committed
Unify type path suffix
1 parent 40cefa7 commit 33d3622

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pathtraits/db.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ def row_factory(cursor, row):
3434
if v is None:
3535
continue
3636
# sqlite don't know bool
37-
if k.endswith("_BOOL"):
37+
if k.endswith("/BOOL"):
3838
v = v > 0
3939
if isinstance(v, float):
4040
v_int = int(v)
4141
v = v_int if v_int == v else v
42-
k = k.removesuffix("_TEXT").removesuffix("_REAL").removesuffix("_BOOL")
42+
k = k.removesuffix("/TEXT").removesuffix("/REAL").removesuffix("/BOOL")
4343
res[k] = v
4444
return res
4545

@@ -334,7 +334,7 @@ def add_pathpair(self, pair: PathPair):
334334
# get element type for list
335335
# add: handle lists with mixed element type
336336
t = type(v[0]) if isinstance(v, list) else type(v)
337-
k = f"{k}_{TraitsDB.sql_type(t)}"
337+
k = f"{k}/{TraitsDB.sql_type(t)}"
338338
if k not in self.traits:
339339
t = type(v[0]) if isinstance(v, list) else type(v)
340340
self.create_trait_table(k, t)

test/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_example(self):
6363

6464
def test_data_view(self):
6565
source = len(self.db.execute("SELECT * FROM data;").fetchall())
66-
target = 6
66+
target = 10
6767
self.assertEqual(source, target)
6868

6969

0 commit comments

Comments
 (0)