/opt/alt/python37/lib64/python3.7/idlelib/idle_test
"Test delegator, coverage 100%." from idlelib.delegator import Delegator import unittest class DelegatorTest(unittest.TestCase): def test_mydel(self): # Test a simple use scenario. # Initialize an int delegator. mydel = Delegator(int) self.assertIs(mydel.delegate, int) self.assertEqual(mydel._Delegator__cache, set()) # Trying to access a non-attribute of int fails. self.assertRaises(AttributeError, mydel.__getattr__, 'xyz') # Add real int attribute 'bit_length' by accessing it. bl = mydel.bit_length self.assertIs(bl, int.bit_length) self.assertIs(mydel.__dict__['bit_length'], int.bit_length) self.assertEqual(mydel._Delegator__cache, {'bit_length'}) # Add attribute 'numerator'. mydel.numerator self.assertEqual(mydel._Delegator__cache, {'bit_length', 'numerator'}) # Delete 'numerator'. del mydel.numerator self.assertNotIn('numerator', mydel.__dict__) # The current implementation leaves it in the name cache. # self.assertIn('numerator', mydel._Delegator__cache) # However, this is not required and not part of the specification # Change delegate to float, first resetting the attributes. mydel.setdelegate(float) # calls resetcache self.assertNotIn('bit_length', mydel.__dict__) self.assertEqual(mydel._Delegator__cache, set()) self.assertIs(mydel.delegate, float) if __name__ == '__main__': unittest.main(verbosity=2, exit=2)
.
Edit
..
Edit
README.txt
Edit
__init__.py
Edit
__pycache__
Edit
htest.py
Edit
mock_idle.py
Edit
mock_tk.py
Edit
template.py
Edit
test_autocomplete.py
Edit
test_autocomplete_w.py
Edit
test_autoexpand.py
Edit
test_browser.py
Edit
test_calltip.py
Edit
test_calltip_w.py
Edit
test_codecontext.py
Edit
test_colorizer.py
Edit
test_config.py
Edit
test_config_key.py
Edit
test_configdialog.py
Edit
test_debugger.py
Edit
test_debugger_r.py
Edit
test_debugobj.py
Edit
test_debugobj_r.py
Edit
test_delegator.py
Edit
test_editmenu.py
Edit
test_editor.py
Edit
test_filelist.py
Edit
test_format.py
Edit
test_grep.py
Edit
test_help.py
Edit
test_help_about.py
Edit
test_history.py
Edit
test_hyperparser.py
Edit
test_iomenu.py
Edit
test_macosx.py
Edit
test_mainmenu.py
Edit
test_multicall.py
Edit
test_outwin.py
Edit
test_parenmatch.py
Edit
test_pathbrowser.py
Edit
test_percolator.py
Edit
test_pyparse.py
Edit
test_pyshell.py
Edit
test_query.py
Edit
test_redirector.py
Edit
test_replace.py
Edit
test_rpc.py
Edit
test_run.py
Edit
test_runscript.py
Edit
test_scrolledlist.py
Edit
test_search.py
Edit
test_searchbase.py
Edit
test_searchengine.py
Edit
test_sidebar.py
Edit
test_squeezer.py
Edit
test_stackviewer.py
Edit
test_statusbar.py
Edit
test_text.py
Edit
test_textview.py
Edit
test_tooltip.py
Edit
test_tree.py
Edit
test_undo.py
Edit
test_warning.py
Edit
test_window.py
Edit
test_zoomheight.py
Edit