void () { final PyEvaluator evaluator = new PyEvaluator(); evaluator.setEvaluateCollectionItems(false); final Map map = PyUtil.as(evaluator.evaluate(parseText("a='a'\none=1\ntwo=2\nb='b'\nexpr={a: one, two: b}")), Map.class); assertNotNull(map); assertEquals(2, map.size()); final AtomicInteger checks = new AtomicInteger(); map.forEach( (k, v) -> { if (k instanceof String) { assertEquals("a", k); assertInstanceOf(v, PyReferenceExpression.class); assertEquals(1, evaluator.evaluate((PyReferenceExpression)v)); checks.incrementAndGet(); } else if (k instanceof Integer) { assertEquals(2, k); assertInstanceOf(v, PyReferenceExpression.class); assertEquals("b", evaluator.evaluate((PyReferenceExpression)v)); checks.incrementAndGet(); } } ); assertEquals(2, checks.get()); }