mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-01 18:27:18 +00:00
Reformatted list (#5919)
* Reformatted list * [autofix.ci] apply automated fixes * Reformatted list * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
8f78052493
commit
41555edab9
2 changed files with 31 additions and 5 deletions
|
|
@ -64,11 +64,11 @@ def format_msgpack(
|
|||
|
||||
elif type(data) is list:
|
||||
output[-1] += [("text", "[")]
|
||||
for item in data:
|
||||
|
||||
for count, item in enumerate(data):
|
||||
output.append([indent, ("text", " ")])
|
||||
format_msgpack(item, output, indent_count + 1)
|
||||
|
||||
if item != data[-1]:
|
||||
if count != len(data) - 1:
|
||||
output[-1] += [("text", ",")]
|
||||
|
||||
output.append([indent, ("text", "]")])
|
||||
|
|
|
|||
|
|
@ -57,7 +57,9 @@ def test_format_msgpack():
|
|||
[("text", ""), ("text", "}")],
|
||||
]
|
||||
|
||||
assert list(msgpack.format_msgpack({"object": {"key": "value"}, "list": [1]})) == [
|
||||
assert list(
|
||||
msgpack.format_msgpack({"object": {"key": "value"}, "list": [0, 0, 1, 0, 0]})
|
||||
) == [
|
||||
[("text", "{")],
|
||||
[
|
||||
("text", ""),
|
||||
|
|
@ -81,7 +83,31 @@ def test_format_msgpack():
|
|||
("text", ": "),
|
||||
("text", "["),
|
||||
],
|
||||
[("text", " "), ("text", " "), ("Token_Literal_Number", "1")],
|
||||
[
|
||||
("text", " "),
|
||||
("text", " "),
|
||||
("Token_Literal_Number", "0"),
|
||||
("text", ","),
|
||||
],
|
||||
[
|
||||
("text", " "),
|
||||
("text", " "),
|
||||
("Token_Literal_Number", "0"),
|
||||
("text", ","),
|
||||
],
|
||||
[
|
||||
("text", " "),
|
||||
("text", " "),
|
||||
("Token_Literal_Number", "1"),
|
||||
("text", ","),
|
||||
],
|
||||
[
|
||||
("text", " "),
|
||||
("text", " "),
|
||||
("Token_Literal_Number", "0"),
|
||||
("text", ","),
|
||||
],
|
||||
[("text", " "), ("text", " "), ("Token_Literal_Number", "0")],
|
||||
[("text", " "), ("text", "]")],
|
||||
[("text", ""), ("text", "}")],
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue