From 0f147bb66ad64992fd6f026f57e2720269380ae3 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Sat, 17 Oct 2020 22:24:14 -0400 Subject: [PATCH] added another complex testcase for parsing --- tests/test_parser.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_parser.py b/tests/test_parser.py index 36d19ce..da09dd8 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -48,3 +48,25 @@ class Basic(TestCase): self.assertListEqual( obj, [549, Decimal("3.14"), False, " Ralph ", PDFName("SomeName")] ) + + def test_parse_nested_array(self): + parser = PDFParser( + io.BytesIO( + br"""[ [10 30] [22 33] [ + << /x 0 /y 5 >> + << /x 10 /y 5 >> + ] ]""" + ) + ) + obj = next(parser.iter_objects()) + self.assertListEqual( + obj, + [ + [10, 30], + [22, 33], + [ + {PDFName("x"): 0, PDFName("y"): 5}, + {PDFName("x"): 10, PDFName("y"): 5}, + ], + ], + )