##// END OF EJS Templates
revlog: subclass the new `repository.iverifyproblem` Protocol class...
revlog: subclass the new `repository.iverifyproblem` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. We shouldn't have to explicitly subclass, but I'm doing so to test the interplay of regular attributes and the `attrs` class. Also, PyCharm has a nifty feature that puts a jump point in the gutter to navigate back and forth between the base class and subclasses (and override functions and base class functions) when there's an explicit subclassing. Additionally, PyCharm will immediately flag signature mismatches without a 40m pytype run.

File last commit:

r49730:6000f5b2 default
r53365:4ef6dbc2 default
Show More
test-lfs-pointer.py
42 lines | 1.2 KiB | text/x-python | PythonLexer
/ tests / test-lfs-pointer.py
Augie Fackler
tests: port test-lfs-pointer.py to Python 3...
r37947 # Import something from Mercurial, so the module loader gets initialized.
from mercurial import pycompat
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
tests: port test-lfs-pointer.py to Python 3...
r37947 del pycompat # unused for now
Matt Harbison
lfs: import the Facebook git-lfs client extension...
r35097 from hgext.lfs import pointer
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Harbison
lfs: import the Facebook git-lfs client extension...
r35097 def tryparse(text):
r = {}
try:
r = pointer.deserialize(text)
print('ok')
except Exception as ex:
Augie Fackler
tests: port test-lfs-pointer.py to Python 3...
r37947 print((b'%s' % ex).decode('ascii'))
Matt Harbison
lfs: import the Facebook git-lfs client extension...
r35097 if r:
text2 = r.serialize()
if text2 != text:
print('reconstructed text differs')
return r
Augie Fackler
formatting: blacken the codebase...
r43346
t = (
b'version https://git-lfs.github.com/spec/v1\n'
b'oid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1'
b'258daaa5e2ca24d17e2393\n'
b'size 12345\n'
b'x-foo extra-information\n'
)
Matt Harbison
lfs: import the Facebook git-lfs client extension...
r35097
Augie Fackler
tests: port test-lfs-pointer.py to Python 3...
r37947 tryparse(b'')
Matt Harbison
lfs: import the Facebook git-lfs client extension...
r35097 tryparse(t)
Augie Fackler
tests: port test-lfs-pointer.py to Python 3...
r37947 tryparse(t.replace(b'git-lfs', b'unknown'))
tryparse(t.replace(b'v1\n', b'v1\n\n'))
tryparse(t.replace(b'sha256', b'ahs256'))
tryparse(t.replace(b'sha256:', b''))
tryparse(t.replace(b'12345', b'0x12345'))
tryparse(t.replace(b'extra-information', b'extra\0information'))
tryparse(t.replace(b'extra-information', b'extra\ninformation'))
tryparse(t.replace(b'x-foo', b'x_foo'))
tryparse(t.replace(b'oid', b'blobid'))
tryparse(t.replace(b'size', b'size-bytes').replace(b'oid', b'object-id'))