summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test/test_grep.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-06-15 22:38:35 (GMT)
committerGitHub <noreply@github.com>2018-06-15 22:38:35 (GMT)
commit508568764593dca3844a51c10f1493413a51d66f (patch)
treea4a9f17527b5c6f12c6f7c8fe8eb69ef781086f0 /Lib/idlelib/idle_test/test_grep.py
parent046da1669598d6112d0a6fb056081f3eb5a4d4e7 (diff)
downloadcpython-508568764593dca3844a51c10f1493413a51d66f.zip
cpython-508568764593dca3844a51c10f1493413a51d66f.tar.gz
cpython-508568764593dca3844a51c10f1493413a51d66f.tar.bz2
bpo-33855: Minimally test all IDLE modules. (GH-7689)
Create a template for minimally testing a tkinter-using module by importing it and instantiating its class(es). Add a test file for all non-startup IDLE modules. Edit existing files and update coverage. This is part 1 of 3, covering the 21 autocomplete to help modules and touching 33 idlelib files. (cherry picked from commit ee5ef309c7e2daef1248730145408f700732c42e) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/idlelib/idle_test/test_grep.py')
-rw-r--r--Lib/idlelib/idle_test/test_grep.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/idlelib/idle_test/test_grep.py b/Lib/idlelib/idle_test/test_grep.py
index 6b54c13..ab0d786 100644
--- a/Lib/idlelib/idle_test/test_grep.py
+++ b/Lib/idlelib/idle_test/test_grep.py
@@ -3,14 +3,15 @@ Non-gui unit tests for grep.GrepDialog methods.
dummy_command calls grep_it calls findfiles.
An exception raised in one method will fail callers.
Otherwise, tests are mostly independent.
-*** Currently only test grep_it.
+Currently only test grep_it, coverage 51%.
"""
+from idlelib.grep import GrepDialog
import unittest
from test.support import captured_stdout
from idlelib.idle_test.mock_tk import Var
-from idlelib.grep import GrepDialog
import re
+
class Dummy_searchengine:
'''GrepDialog.__init__ calls parent SearchDiabolBase which attaches the
passed in SearchEngine instance as attribute 'engine'. Only a few of the
@@ -21,6 +22,7 @@ class Dummy_searchengine:
searchengine = Dummy_searchengine()
+
class Dummy_grep:
# Methods tested
#default_command = GrepDialog.default_command
@@ -34,6 +36,7 @@ class Dummy_grep:
grep = Dummy_grep()
+
class FindfilesTest(unittest.TestCase):
# findfiles is really a function, not a method, could be iterator
# test that filename return filename
@@ -41,6 +44,7 @@ class FindfilesTest(unittest.TestCase):
# test that recursive flag adds idle_test .py files
pass
+
class Grep_itTest(unittest.TestCase):
# Test captured reports with 0 and some hits.
# Should test file names, but Windows reports have mixed / and \ separators
@@ -71,10 +75,12 @@ class Grep_itTest(unittest.TestCase):
self.assertIn('2', lines[3]) # hits found 2
self.assertTrue(lines[4].startswith('(Hint:'))
+
class Default_commandTest(unittest.TestCase):
# To write this, move outwin import to top of GrepDialog
# so it can be replaced by captured_stdout in class setup/teardown.
pass
+
if __name__ == '__main__':
- unittest.main(verbosity=2, exit=False)
+ unittest.main(verbosity=2)