From 0ad0e5f84ef01d7e798fea853281006891330563 Mon Sep 17 00:00:00 2001 From: Bradley Miller Date: Wed, 20 Dec 2023 11:31:14 -0600 Subject: [PATCH] Fix error when table not found --- src/lib/document.js | 12 +++++++++--- src/lib/unittest/gui.py | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/lib/document.js b/src/lib/document.js index 9d42211d5..ef8c6fbdd 100644 --- a/src/lib/document.js +++ b/src/lib/document.js @@ -59,9 +59,15 @@ function $builtinmodule() { if (Sk.divid !== undefined && window.componentMap !== undefined) { if (Sk.gradeContainer != Sk.divid) { var edKey = Sk.gradeContainer + " " + Sk.divid; - return new Sk.builtin.str( - window.componentMap[edKey].editor.getValue() - ); + if (edKey in window.componentMap) { + return new Sk.builtin.str( + window.componentMap[edKey].editor.getValue() + ); + } else { + return new Sk.builtin.str( + window.componentMap[Sk.divid].editor.getValue() + ); + } } return new Sk.builtin.str( window.componentMap[Sk.divid].editor.getValue() diff --git a/src/lib/unittest/gui.py b/src/lib/unittest/gui.py index 9664db1fa..60c069be6 100644 --- a/src/lib/unittest/gui.py +++ b/src/lib/unittest/gui.py @@ -197,7 +197,7 @@ def showSummary(self): except: print( - "failed to find object to record unittest results! {}".format( - pctcorrect + "failed to find object to record unittest results in {}! {}".format( + self.closestDiv, pctcorrect ) )