[issue26323] Add a assert_called() method for mock objects

2016-02-18 Thread Amit Saha

Amit Saha added the comment:

Updated patch

--
Added file: http://bugs.python.org/file41952/issue26323.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-18 Thread Amit Saha

Amit Saha added the comment:

Thanks for the review. Updated patch addressing the comments.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-18 Thread STINNER Victor

STINNER Victor added the comment:

I reviewed your patch.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-17 Thread Amit Saha

Amit Saha added the comment:

Added assert_call_once()

--
Added file: http://bugs.python.org/file41946/issue26323.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-17 Thread Kushal Das

Kushal Das added the comment:

Go ahead and update the patch for assert_called_once and related tests.

--
nosy: +kushal.das

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-17 Thread Amit Saha

Amit Saha added the comment:

Thanks for your comments. I am +1 to those additions and would be happy to 
update the patch. Let me know if I should go ahead.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-17 Thread STINNER Victor

STINNER Victor added the comment:

> I would be more consitent with the existing API:

Hum, I'm not sure that I was clear.

If we only add assert_called() (without assert_called_once()), users may use 
assert_called() to check if a function is called exactly once which would be a 
mistake.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-17 Thread STINNER Victor

STINNER Victor added the comment:

If we go into this direction, I suggest to add *two* methods:

* assert_called(): called at least once
* assert_called_once(): called exactly once

I would be more consitent with the existing API:

https://docs.python.org/dev/library/unittest.mock.html#unittest.mock.Mock.assert_not_called

https://docs.python.org/dev/library/unittest.mock.html#unittest.mock.Mock.assert_called_with

https://docs.python.org/dev/library/unittest.mock.html#unittest.mock.Mock.assert_called_once_with

--
nosy: +haypo, rbcollins
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-11 Thread Amit Saha

Amit Saha added the comment:

Please take a look at the attached patch.

--
keywords: +patch
Added file: http://bugs.python.org/file41903/issue26323.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-11 Thread Amit Saha

Amit Saha added the comment:

Fixed the test name

--
Added file: http://bugs.python.org/file41904/issue26323.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-09 Thread Amit Saha

Changes by Amit Saha :


--
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-09 Thread Amit Saha

New submission from Amit Saha:

Would a patch for adding a assert_called() method to mocked objects be welcome 
for inclusion? We do have a assert_not_called() method, so I think this may be 
a good idea. Please let me know and I will work on it.

--
components: Library (Lib)
messages: 259960
nosy: Amit.Saha
priority: normal
severity: normal
status: open
title: Add a assert_called() method for mock objects

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-09 Thread Florian Bruhin

Florian Bruhin added the comment:

I agree this would be useful. "assert themock.called" (or self.assertTrue) 
works, but always trips me up.

--
nosy: +The Compiler

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26323] Add a assert_called() method for mock objects

2016-02-09 Thread Florian Bruhin

Changes by Florian Bruhin :


--
nosy: +michael.foord

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com