void () { final PyEvaluator evaluator = new PyEvaluator(); evaluator.setEvaluateKeys(false); 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) -> { assertInstanceOf(k, PyReferenceExpression.class); assertInstanceOf(v, PyReferenceExpression.class); final Object evaluatedK = evaluator.evaluate((PyReferenceExpression)k); final Object evaluatedV = evaluator.evaluate((PyReferenceExpression)v); if (evaluatedK instanceof String) { assertInstanceOf(evaluatedV, Integer.class); assertEquals("a", evaluatedK); assertEquals(1, evaluatedV); checks.incrementAndGet(); } else if (evaluatedK instanceof Integer) { assertInstanceOf(evaluatedV, String.class); assertEquals(2, evaluatedK); assertEquals("b", evaluatedV); checks.incrementAndGet(); } } ); assertEquals(2, checks.get()); }