-
Notifications
You must be signed in to change notification settings - Fork 260
Use new msgpack spec by default. #386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,12 @@ | ||
| #!/usr/bin/env python | ||
| # coding: utf-8 | ||
|
|
||
| from msgpack import packb, unpackb | ||
|
|
||
|
|
||
| def check(length, obj): | ||
| v = packb(obj) | ||
| def check(length, obj, use_bin_type=True): | ||
| v = packb(obj, use_bin_type=use_bin_type) | ||
| assert len(v) == length, "%r length should be %r but get %r" % (obj, length, len(v)) | ||
| assert unpackb(v, use_list=0) == obj | ||
| assert unpackb(v, use_list=0, raw=not use_bin_type) == obj | ||
|
|
||
|
|
||
| def test_1(): | ||
|
|
@@ -56,7 +55,7 @@ def test_9(): | |
|
|
||
|
|
||
| def check_raw(overhead, num): | ||
| check(num + overhead, b" " * num) | ||
| check(num + overhead, b" " * num, use_bin_type=False) | ||
|
|
||
|
|
||
| def test_fixraw(): | ||
|
|
@@ -135,4 +134,4 @@ def test_match(): | |
|
|
||
|
|
||
| def test_unicode(): | ||
| assert unpackb(packb("foobar"), use_list=1) == b"foobar" | ||
| assert unpackb(packb(u"foobar"), use_list=1) == u"foobar" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. somehow makes more sense now. \o/
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are there enough tests that check all "old msgpack" behaviour as well as all "new msgpack" behaviour (str, bytes, unicode). esp. that using it the old way still works with the new code, when the right options are given. borgbackup depends on old format and as people have that in their backup repositories, we can't change it. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo