Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_deserializer_json(self):
ser = get_deserializer(Format.JSON)
self.assertEqual(ser, _deserialize_json)
def test_roundtrip_json(self):
ser = get_serializer(Format.JSON)
deser = get_deserializer(Format.JSON)
fp = StringIO()
ser(date_sample, fp)
fp.seek(0)
obj = deser(fp)
self.assertEqual(obj, date_sample)
def __init__(self, prefix=None, debug=False, record_format=Format.JSON):
if debug:
self._set_logger(__name__, logging.DEBUG)
record_format = record_format.lower()
if record_format not in Format.ALLOWED:
LOG.warning("Record format not allowed. Falling back to default.")
record_format = Format.DEFAULT
self._serializer = get_serializer(record_format)
self._filename_re = re.compile(r'.*\..*_(?P\d+).{0}'.format(
record_format))
self._record_format = record_format
self.prefix = prefix
self._uuid = str(uuid.uuid4())
self._data_path = None
self._mode = None