[issue35500] Align expected and actual calls on mock.assert_called_with error message
Adnan Umer added the comment: Please ignore my above message. I accidentally added that here. Sorry :( -- ___ Python tracker <https://bugs.python.org/issue35500> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35577] side_effect mocked method lose reference to instance
New submission from Adnan Umer : When a method/bounded function is mocked and side_effect is supplied to it, the side_effect function doesn't get the reference to the instance. Suppose we have something like this class SomeClass: def do_something(self, x): pass def some_function(x): cls = SomeClass() y = class.do_something(x) return y And the test for some_function will be def do_something_side_effect(x): retrun x def test_some_function(): with mock.path("SomeCass.do_something") as do_something_mock: do_something_mock.side_effect = do_something_side_effect assert some_function(1) Here do_something_side_effect mock will not have access to SomeClass instance. -- components: Library (Lib) messages: 332463 nosy: Adnan Umer priority: normal severity: normal status: open title: side_effect mocked method lose reference to instance type: enhancement versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue35577> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35500] Align expected and actual calls on mock.assert_called_with error message
Adnan Umer added the comment: When a method/bounded function is mocked and side_effect is supplied to it, the side_effect function doesn't get the reference to the instance. Suppose we have something like this class SomeClass: def do_something(self, x): pass def some_function(x): cls = SomeClass() y = class.do_something(x) return y And the test for some_function will be def do_something_side_effect(x): retrun x def test_some_function(): with mock.path("SomeCass.do_something") as do_something_mock: do_something_mock.side_effect = do_something_side_effect assert some_function(1) Here do_something_side_effect mock will not have access to SomeClass instance. -- nosy: +Adnan Umer versions: -Python 3.8 ___ Python tracker <https://bugs.python.org/issue35500> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21192] Idle: Print filename when running a file from editor
Adnan Umer added the comment: I tried to replace RESTART by doing these little changing # PyShell.Py class ModifiedInterpreter(InteractiveInterpreter): def restart_subprocess(self, with_cwd=False, with_msg=True): ... if with_msg: halfbar = ((int(console.width) - 16) // 2) * '=' console.write(halfbar + ' RESTART ' + halfbar) def runcode(self, code): with_msg = True if code.co_filename[0] != '': self.tkconsole.write('Executing ' + code.co_filename + '\n') with_msg = False if self.tkconsole.executing: self.interp.restart_subprocess(with_msg) # ScriptBinding.Py class ScriptBinding: def _run_module_event(self, event): filename = self.getfilename() if not filename: return 'break' code = self.checksyntax(filename) if not code: return 'break' if not self.tabnanny(filename): return 'break' interp = self.shell.interp if PyShell.use_subprocess: interp.restart_subprocess(with_cwd=False, with_msg=False) This works fine and replaces RESTART with Execute filename when file is executed in Python Shell. Also instead of this halfbar = ((int(console.width) - 16) // 2) * '=' console.write(halfbar + ' RESTART ' + halfbar) my recomemdation is: console.write('[SHELL RESTART]') -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21192] Idle: Print filename when running a file from editor
Adnan Umer added the comment: Method: runcode Class: ModifiedInterpreter Line: 752 Added if code.co_filename[0] != '': self.tkconsole.write('Executing ' + code.co_filename + '\n') To print file path that is executed -- nosy: +Adnan.Umer versions: +Python 3.4 Added file: http://bugs.python.org/file34783/PyShell.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21192] Idle: Print filename when running a file from editor
Changes by Adnan Umer adnanume...@gmail.com: -- components: +IDLE ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com