void () { runPythonTest(new PyDebuggerTask("/debug", "test_large_collections.py") { @Override public void before() { toggleBreakpoint(getFilePath(getScriptName()), 15); } @Override public void testing() throws Exception { waitForPause(); List<PyDebugValue> frameVariables = loadFrame(); // The effective maximum number of the debugger returns is MAX_ITEMS_TO_HANDLE // plus the "Protected Attributes" group. final int effectiveMaxItemsNumber = MAX_ITEMS_TO_HANDLE + 1; // Large list. PyDebugValue L = findDebugValueByName(frameVariables, "L"); XValueChildrenList children = loadVariable(L); int collectionLength = 1000; assertEquals(effectiveMaxItemsNumber, children.size()); for (int i = 0; i < MAX_ITEMS_TO_HANDLE; i++) { assertTrue(hasChildWithName(children, formatStr(i, collectionLength))); assertTrue(hasChildWithValue(children, i)); } L.setOffset(600); children = loadVariable(L); assertEquals(effectiveMaxItemsNumber, children.size()); for (int i = 600; i < 600 + MAX_ITEMS_TO_HANDLE; i++) { assertTrue(hasChildWithName(children, formatStr(i, collectionLength))); assertTrue(hasChildWithValue(children, i)); } L.setOffset(900); children = loadVariable(L); assertEquals(101, children.size()); for (int i = 900; i < collectionLength; i++) { assertTrue(hasChildWithName(children, formatStr(i, collectionLength))); assertTrue(hasChildWithValue(children, i)); } // Large dict. PyDebugValue D = findDebugValueByName(frameVariables, "D"); children = loadVariable(D); assertEquals(effectiveMaxItemsNumber, children.size()); for (int i = 0; i < MAX_ITEMS_TO_HANDLE; i++) { assertTrue(hasChildWithName(children, i)); assertTrue(hasChildWithValue(children, i)); } D.setOffset(600); children = loadVariable(D); assertEquals(effectiveMaxItemsNumber, children.size()); for (int i = 600; i < 600 + MAX_ITEMS_TO_HANDLE; i++) { assertTrue(hasChildWithName(children, i)); assertTrue(hasChildWithValue(children, i)); } D.setOffset(900); children = loadVariable(D); assertEquals(101, children.size()); for (int i = 900; i < collectionLength; i++) { assertTrue(hasChildWithName(children, i)); assertTrue(hasChildWithValue(children, i)); } // Large set. PyDebugValue S = findDebugValueByName(frameVariables, "S"); children = loadVariable(S); assertEquals(effectiveMaxItemsNumber, children.size()); for (int i = 0; i < MAX_ITEMS_TO_HANDLE; i++) { assertTrue(hasChildWithValue(children, i)); } S.setOffset(600); children = loadVariable(S); assertEquals(effectiveMaxItemsNumber, children.size()); for (int i = 600; i < 600 + MAX_ITEMS_TO_HANDLE; i++) { assertTrue(hasChildWithValue(children, i)); } S.setOffset(900); children = loadVariable(S); assertEquals(101, children.size()); for (int i = 900; i < collectionLength; i++) { assertTrue(hasChildWithValue(children, i)); } // Large deque. PyDebugValue dq = findDebugValueByName(frameVariables, "dq"); children = loadVariable(dq); assertEquals(effectiveMaxItemsNumber + 1, children.size()); // one extra child for maxlen for (int i = 1; i < MAX_ITEMS_TO_HANDLE; i++) { assertTrue(hasChildWithName(children, formatStr(i, collectionLength))); assertTrue(hasChildWithValue(children, i)); } dq.setOffset(600); children = loadVariable(dq); assertEquals(effectiveMaxItemsNumber, children.size()); for (int i = 600; i < 600 + MAX_ITEMS_TO_HANDLE; i++) { assertTrue(hasChildWithName(children, formatStr(i, collectionLength))); assertTrue(hasChildWithValue(children, i)); } dq.setOffset(900); children = loadVariable(dq); assertEquals(101, children.size()); for (int i = 900; i < collectionLength; i++) { assertTrue(hasChildWithName(children, formatStr(i, collectionLength))); assertTrue(hasChildWithValue(children, i)); } } }); }