diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2022-12-02 17:14:31 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2022-12-02 17:14:31 -0500 |
commit | 761d8337fb70cea9cfb326f06a8b1b35438ed96b (patch) | |
tree | bd9f521059099a59ad89f29e64275a4278b926ae /indra | |
parent | 2f557cd7faceec36acace1eee4ee38904ff06130 (diff) |
SL-18330: Test Python llsd.parse() both from bytes and from stream.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/tests/llsdserialize_test.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 39b93cf335..6e5d8a26e1 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1958,6 +1958,7 @@ namespace tut placeholders::arg1 << import_llsd << "from functools import partial\n" + "import io\n" "import struct\n" "lenformat = struct.Struct('i')\n" "def parse_each(inf):\n" @@ -1968,11 +1969,16 @@ namespace tut // into a distinct bytes object and parse that. " data = inf.read(len)\n" " try:\n" - " yield llsd.parse(data)\n" + " frombytes = llsd.parse(data)\n" " except llsd.LLSDParseError as err:\n" " print(f'*** {err}')\n" " print(f'Bad content:\\n{data!r}')\n" " raise\n" + // Also try parsing from a distinct stream. + " stream = io.BytesIO(data)\n" + " fromstream = llsd.parse(stream)\n" + " assert frombytes == fromstream\n" + " yield frombytes\n" << pydata << // Don't forget raw-string syntax for Windows pathnames. "verify(parse_each(open(r'" << file.getName() << "', 'rb')))\n"); |