Skip to content

Commit

Permalink
Merge pull request #770 from castorf/master
Browse files Browse the repository at this point in the history
lowercase null_values for data_types.
  • Loading branch information
jpmckinney committed Oct 4, 2023
2 parents 66222ec + ac89331 commit c773cb7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion agate/data_types/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DataType: # pragma: no cover
:code:`None` when encountered by this data type.
"""
def __init__(self, null_values=DEFAULT_NULL_VALUES):
self.null_values = null_values
self.null_values = [v.lower() for v in null_values]

def test(self, d):
"""
Expand Down
4 changes: 4 additions & 0 deletions tests/test_data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def test_no_cast_nulls(self):
casted = tuple(t.cast(v) for v in values)
self.assertSequenceEqual(casted, ('', 'N/A', None))

def test_null_values(self):
t = Text(null_values=['Bad Value'])
self.assertEqual(t.cast('Bad Value'), None)


class TestBoolean(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit c773cb7

Please sign in to comment.