diff --git a/tap_spreadsheets_anywhere/test/test_conversion.py b/tap_spreadsheets_anywhere/test/test_conversion.py index fde47f6..49b4686 100644 --- a/tap_spreadsheets_anywhere/test/test_conversion.py +++ b/tap_spreadsheets_anywhere/test/test_conversion.py @@ -38,7 +38,7 @@ def test_convert(self): # strings self.assertEqual(convert('4 o clock'), ('4 o clock', 'string')) - # objects + def test_convert_objects(self): self.assertEqual(convert("{'k': 'v','k': 'v'}"), ("{'k': 'v','k': 'v'}", 'string')) self.assertEqual(convert({'k': 'v','k': 'v'}), ({'k': 'v','k': 'v'}, 'object')) self.assertEqual(convert({'k': 'v','k': 'v'}, 'object'), ({'k': 'v','k': 'v'}, 'object')) @@ -59,7 +59,6 @@ def test_pick_datatype(self): self.assertEqual(pick_datatype({'string': 1}), 'string') self.assertEqual(pick_datatype({'integer': 1}), 'integer') self.assertEqual(pick_datatype({'number': 1}), 'number') - self.assertEqual(pick_datatype({'object': 1}), 'object') self.assertEqual(pick_datatype({'number': 1, 'integer': 1}), 'number') @@ -68,10 +67,13 @@ def test_pick_datatype(self): 'integer': 1}), 'string') self.assertEqual(pick_datatype({'string': 1, 'number': 1}), 'string') - self.assertEqual(pick_datatype({'string': 1, - 'object': 1}), 'string') self.assertEqual(pick_datatype({}), 'string') + def test_pick_datatype_objects(self): + self.assertEqual(pick_datatype({'object': 1}), 'object') + self.assertEqual(pick_datatype({'string': 1, + 'object': 1}), 'string') + def test_generate_schema(self): self.assertEqual( generate_schema([{'id': '1', 'first_name': 'Connor'}, @@ -97,6 +99,7 @@ def test_generate_schema(self): {'id': {'type': ['null', 'integer'],}, 'date': {'type': ['null', 'string'],}}) + def test_generate_schema_objects(self): self.assertEqual( generate_schema([{'id': '1', 'obj': { 'date': '2017-01-01', 'count': 100 }}, {'id': '2', 'obj': { 'date': '2017-01-01', 'count': 0 }}]),