mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-11 19:14:10 +02:00
Merge cffe30fd2f into a947dc6739
This commit is contained in:
commit
bec3c3c81d
2 changed files with 19 additions and 1 deletions
|
|
@ -490,7 +490,7 @@ class ValueTracker:
|
||||||
return "text"
|
return "text"
|
||||||
|
|
||||||
def evaluate(self, value: object) -> None:
|
def evaluate(self, value: object) -> None:
|
||||||
if not value or not self.couldbe:
|
if value is None or not self.couldbe:
|
||||||
return
|
return
|
||||||
not_these: List[str] = []
|
not_these: List[str] = []
|
||||||
for name, test in self.couldbe.items():
|
for name, test in self.couldbe.items():
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from sqlite_utils import utils
|
from sqlite_utils import utils
|
||||||
|
from sqlite_utils.utils import TypeTracker
|
||||||
import csv
|
import csv
|
||||||
import io
|
import io
|
||||||
import pytest
|
import pytest
|
||||||
|
|
@ -73,6 +74,23 @@ def test_maximize_csv_field_size_limit():
|
||||||
assert rows_list2[0]["text"] == long_value
|
assert rows_list2[0]["text"] == long_value
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"rows,expected_types",
|
||||||
|
[
|
||||||
|
([{"a": ""}], {"a": "text"}),
|
||||||
|
([{"a": ""}, {"a": ""}], {"a": "text"}),
|
||||||
|
([{"a": "1"}, {"a": ""}], {"a": "text"}),
|
||||||
|
([{"a": "0"}], {"a": "integer"}),
|
||||||
|
([{"a": "1"}], {"a": "integer"}),
|
||||||
|
([{"a": None}], {"a": "integer"}),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_type_tracker_empty_strings(rows, expected_types):
|
||||||
|
tracker = TypeTracker()
|
||||||
|
list(tracker.wrap(iter(rows)))
|
||||||
|
assert tracker.types == expected_types
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"input,expected",
|
"input,expected",
|
||||||
(
|
(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue