Changeset d5b48e6 in trunk


Ignore:
Timestamp:
2021-08-27T14:14:39Z (4 years ago)
Author:
Itamar Turner-Trauring <itamar@…>
Branches:
master
Children:
4c750cf
Parents:
bb48974f
Message:

Fix bug in jsonbytes.

Location:
src/allmydata
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/allmydata/test/test_util.py

    rbb48974f rd5b48e6  
    559559        )
    560560
     561    def test_dumps_bytes_unicode_separators(self):
     562        """Unicode separators don't prevent the result from being bytes."""
     563        result = jsonbytes.dumps_bytes([1, 2], separators=(u',', u':'))
     564        self.assertIsInstance(result, bytes)
     565        self.assertEqual(result, b"[1,2]")
     566
    561567
    562568class FakeGetVersion(object):
  • TabularUnified src/allmydata/util/jsonbytes.py

    rbb48974f rd5b48e6  
    110110    """
    111111    result = dumps(obj, *args, **kwargs)
    112     if PY3:
     112    if PY3 or isinstance(result, str):
    113113        result = result.encode("utf-8")
    114114    return result
Note: See TracChangeset for help on using the changeset viewer.