From 761d8337fb70cea9cfb326f06a8b1b35438ed96b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 2 Dec 2022 17:14:31 -0500 Subject: SL-18330: Test Python llsd.parse() both from bytes and from stream. --- indra/llcommon/tests/llsdserialize_test.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') 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"); -- cgit v1.2.3