Skip to content

Commit

Permalink
test nits
Browse files Browse the repository at this point in the history
- match test name letter case
- add print and 2 more test values
- use list comp
  • Loading branch information
mara004 committed Nov 19, 2023
1 parent 29158bd commit 5cdf09e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/javascript/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,17 @@ def test_blobValueOf_generalValue():
print(f"blobValueOf() faster? {t_blob < t_json} (t_blob: {t_blob}, t_json {t_json})")


def test_BlobValueOf_specificValues():
def test_blobValueOf_specificValues():
test_values = [
"Value without newline.",
"Value without newline",
"Value with \nembedded\n newlines",
"\nValue with single enclosing newlines\n",
"\n\nValue with double enclosing newlines\n\n",
"\n", "\n\n", "\n\n\n", "\n"*10, # test various amounts of newlines only
# test an empty string and various amounts of newlines only
"", *["\n"*c for c in (1, 2, 3, 10)]
]
for val in test_values:
print(f"blobValueOf() {val!r}")
# 'from' is a reserved keyword in python, so use dict getitem as a workaround
js_buffer = globalThis.Buffer["from"](val, "utf-8")
blob_value = js_buffer.blobValueOf()
Expand Down Expand Up @@ -169,7 +172,7 @@ def test_nullFromJsReturnsNone():
test_errors()
test_valueOf()
test_blobValueOf_generalValue()
test_BlobValueOf_specificValues()
test_blobValueOf_specificValues()
test_once()
test_assignment()
test_eval()
Expand Down

0 comments on commit 5cdf09e

Please sign in to comment.