mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
484939a75d
Summary: Global states (For example, the global blackbox instance, potentially some logging / tracing libraries) are separate in the Rust and Python worlds. That is because related code gets compiled separately: bindings.so (top-level) \_ blackbox hgmain (top-level) \_ blackbox (have a different global instance than the above blackbox) To address it, make `bindings` a builtin module in `hgmain`. The builtin module was renamed from `edenscmnative.bindings` to `bindings` so it does not require importing anything else (For example, `edenscmnative`). This unfortunately makes `hg` 100+ MB. Fortunately it can be compressed well (gzip: 31MB). Reviewed By: singhsrb Differential Revision: D17429688 fbshipit-source-id: bf16910d7a260ca58db0d272fc95d8071d47bbc6
25 lines
545 B
Python
25 lines
545 B
Python
from __future__ import absolute_import
|
|
|
|
import os
|
|
import unittest
|
|
|
|
import silenttestrunner
|
|
from bindings import zstd
|
|
|
|
|
|
class testzstd(unittest.TestCase):
|
|
def testdelta(self):
|
|
base = os.urandom(100000)
|
|
data = base[:1000] + "x" + base[1000:90000] + base[90500:]
|
|
delta = zstd.diff(base, data)
|
|
|
|
# The delta is tiny
|
|
self.assertLess(len(delta), 100)
|
|
|
|
# The delta can be applied
|
|
self.assertEqual(zstd.apply(base, delta), data)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
silenttestrunner.main(__name__)
|