singer-python 6.0.1__tar.gz → 6.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {singer-python-6.0.1/singer_python.egg-info → singer_python-6.1.1}/PKG-INFO +1 -1
- {singer-python-6.0.1 → singer_python-6.1.1}/setup.cfg +1 -1
- {singer-python-6.0.1 → singer_python-6.1.1}/setup.py +1 -1
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/catalog.py +1 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/messages.py +4 -4
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/schema.py +1 -1
- {singer-python-6.0.1 → singer_python-6.1.1/singer_python.egg-info}/PKG-INFO +1 -1
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_singer.py +26 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/LICENSE +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/README.md +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/__init__.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/bookmarks.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/exceptions.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/logger.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/logging.conf +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/metadata.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/metrics.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/requests.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/statediff.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/transform.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer/utils.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer_python.egg-info/SOURCES.txt +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer_python.egg-info/dependency_links.txt +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer_python.egg-info/requires.txt +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/singer_python.egg-info/top_level.txt +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/__init__.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_bookmarks.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_catalog.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_exceptions.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_metadata.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_metrics.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_schema.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_statediff.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_transform.py +0 -0
- {singer-python-6.0.1 → singer_python-6.1.1}/tests/test_utils.py +0 -0
|
@@ -20,6 +20,7 @@ def write_catalog(catalog):
|
|
|
20
20
|
# pylint: disable=too-many-instance-attributes
|
|
21
21
|
class CatalogEntry():
|
|
22
22
|
|
|
23
|
+
# pylint: disable=too-many-positional-arguments
|
|
23
24
|
def __init__(self, tap_stream_id=None, stream=None,
|
|
24
25
|
key_properties=None, schema=None, replication_key=None,
|
|
25
26
|
is_view=None, database=None, table=None, row_count=None,
|
|
@@ -218,12 +218,12 @@ def parse_message(msg):
|
|
|
218
218
|
return None
|
|
219
219
|
|
|
220
220
|
|
|
221
|
-
def format_message(message):
|
|
222
|
-
return json.dumps(message.asdict(), use_decimal=True)
|
|
221
|
+
def format_message(message, ensure_ascii=True):
|
|
222
|
+
return json.dumps(message.asdict(), use_decimal=True, ensure_ascii=ensure_ascii)
|
|
223
223
|
|
|
224
224
|
|
|
225
|
-
def write_message(message):
|
|
226
|
-
sys.stdout.write(format_message(message) + '\n')
|
|
225
|
+
def write_message(message, ensure_ascii=True):
|
|
226
|
+
sys.stdout.write(format_message(message, ensure_ascii=ensure_ascii) + '\n')
|
|
227
227
|
sys.stdout.flush()
|
|
228
228
|
|
|
229
229
|
|
|
@@ -31,7 +31,7 @@ class Schema(): # pylint: disable=too-many-instance-attributes
|
|
|
31
31
|
|
|
32
32
|
'''
|
|
33
33
|
|
|
34
|
-
# pylint: disable=too-many-locals
|
|
34
|
+
# pylint: disable=too-many-locals,too-many-positional-arguments
|
|
35
35
|
def __init__(self, type=None, format=None, properties=None, items=None,
|
|
36
36
|
selected=None, inclusion=None, description=None, minimum=None,
|
|
37
37
|
maximum=None, exclusiveMinimum=None, exclusiveMaximum=None,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import singer
|
|
2
2
|
import unittest
|
|
3
|
+
from unittest.mock import patch
|
|
3
4
|
import datetime
|
|
4
5
|
import dateutil
|
|
5
6
|
from decimal import Decimal
|
|
@@ -179,6 +180,31 @@ class TestParsingNumbers(unittest.TestCase):
|
|
|
179
180
|
value = self.create_record(value_str)
|
|
180
181
|
self.assertEqual(Decimal(value_str), value)
|
|
181
182
|
|
|
183
|
+
@patch('sys.stdout')
|
|
184
|
+
def test_ensure_ascii_false(self, mock_stdout):
|
|
185
|
+
"""
|
|
186
|
+
Setting ensure_ascii=False will preserve special characters like é
|
|
187
|
+
in their original form.
|
|
188
|
+
"""
|
|
189
|
+
rec = {"name": "José"}
|
|
190
|
+
expected_output = '{"type": "RECORD", "stream": "test_stream", "record": {"name": "José"}}\n'
|
|
191
|
+
rec_message = singer.RecordMessage(stream="test_stream", record=rec)
|
|
192
|
+
result = singer.write_message(rec_message, ensure_ascii=False)
|
|
193
|
+
mock_stdout.write.assert_called_once_with(expected_output)
|
|
194
|
+
mock_stdout.flush.assert_called_once()
|
|
195
|
+
|
|
196
|
+
@patch('sys.stdout')
|
|
197
|
+
def test_ensure_ascii_true(self, mock_stdout):
|
|
198
|
+
"""
|
|
199
|
+
ensure_ascii defaults to True, special characters like é are
|
|
200
|
+
escaped into their ASCII representation (e.g., \u00e9)
|
|
201
|
+
"""
|
|
202
|
+
rec = {"name": "José"}
|
|
203
|
+
expected_output = '{"type": "RECORD", "stream": "test_stream", "record": {"name": "Jos\\u00e9"}}\n'
|
|
204
|
+
rec_message = singer.RecordMessage(stream="test_stream", record=rec)
|
|
205
|
+
result = singer.write_message(rec_message)
|
|
206
|
+
mock_stdout.write.assert_called_once_with(expected_output)
|
|
207
|
+
mock_stdout.flush.assert_called_once()
|
|
182
208
|
|
|
183
209
|
if __name__ == '__main__':
|
|
184
210
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|