Issue #21477: Idle htest: merge and modify run and runall; add many tests.
Patch by Saimadhav Heblikar
diff --git a/Lib/idlelib/ClassBrowser.py b/Lib/idlelib/ClassBrowser.py
index 095b30d..c85340f 100644
--- a/Lib/idlelib/ClassBrowser.py
+++ b/Lib/idlelib/ClassBrowser.py
@@ -13,6 +13,7 @@
 import os
 import sys
 import pyclbr
+import re
 
 from idlelib import PyShell
 from idlelib.WindowList import ListedToplevel
@@ -21,11 +22,15 @@
 
 class ClassBrowser:
 
-    def __init__(self, flist, name, path):
+    def __init__(self, flist, name, path, _htest=False):
         # XXX This API should change, if the file doesn't end in ".py"
         # XXX the code here is bogus!
+        """
+        _htest - bool, change box when location running htest.
+        """
         self.name = name
         self.file = os.path.join(path[0], self.name + ".py")
+        self._htest = _htest
         self.init(flist)
 
     def close(self, event=None):
@@ -40,6 +45,9 @@
         self.top = top = ListedToplevel(flist.root)
         top.protocol("WM_DELETE_WINDOW", self.close)
         top.bind("<Escape>", self.close)
+        if self._htest: # place dialog below parent if running htest
+            top.geometry("+%d+%d" %
+                (flist.root.winfo_rootx(), flist.root.winfo_rooty() + 200))
         self.settitle()
         top.focus_set()
         # create scrolled canvas
@@ -202,7 +210,7 @@
         edit = PyShell.flist.open(self.file)
         edit.gotoline(self.cl.methods[self.name])
 
-def main():
+def _class_browser(parent): #Wrapper for htest
     try:
         file = __file__
     except NameError:
@@ -213,9 +221,9 @@
             file = sys.argv[0]
     dir, file = os.path.split(file)
     name = os.path.splitext(file)[0]
-    ClassBrowser(PyShell.flist, name, [dir])
-    if sys.stdin is sys.__stdin__:
-        mainloop()
+    flist = PyShell.PyShellFileList(parent)
+    ClassBrowser(flist, name, [dir], _htest=True)
 
 if __name__ == "__main__":
-    main()
+    from idlelib.idle_test.htest import run
+    run(_class_browser)