[issue27152] Additional assert methods for unittest

2016-06-22 Thread R. David Murray

R. David Murray added the comment:

I would expect it to be assertEndswith, etc.  You will note that all the other 
cases of multiple capitals are either englishification of symbolic operators or 
concatenations of separate type words and/or syntactically distinct operators.

--

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-06-19 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Ask five people to spell "assertEndsWith" and see how many of them capitalize 
the "W".

--

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-06-19 Thread Pam McA'Nulty

Changes by Pam McA'Nulty :


--
nosy: +Pam.McANulty

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-06-03 Thread Robert Collins

Robert Collins added the comment:

I'm fine with these as a mixin - they are all very generic and unambiguously 
named. I'd marginally prefer the opt-in mixin over adding them to the base 
class.

Ideally they'd be matchers, but since I haven't ported that upstream yet, thats 
asking for more work, and we can always migrate later.

(https://rbtcollins.wordpress.com/2010/05/10/maintainable-pyunit-test-suites/ 
and http://testtools.readthedocs.io/en/latest/for-test-authors.html#matchers - 
sorry about the formatting in the blog post, wordpress changed theme details 
some time after I wrote the post and it now renders horribly :( )

--

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-06-03 Thread Chris Barker

Chris Barker added the comment:

Why a mixin rather than adding to TestCase? If they are useful they should be 
easy to find.

Also, see Issue27198 for another possible new assert.

--
nosy: +ChrisBarker

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-05-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Changes in tests are provided as a demonstration that these methods are useful. 
I propose to commit only the unittest part, and use new methods on a 
case-by-case basis. For example some tests already define methods like 
assertHasAttr or assertIsSubclass, They can now use standard methods.

assertEndsWith() can be used 73 times in 36 files. It produces more useful 
error report than assertTrue(a.endswith(b)).

--

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-05-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I don't really like the assertEndsWith method which triggers a mental hiccup 
when taking a familiar method call, making it into function call, and giving an 
awkward looking camelcase name.

Also, Guido is usually opposed to broad, sweeping search/replace patches.  
Instead, he has advocated "holistic refactoring" where updates are done by 
someone actively working on the module rather than a disinterested party 
churning the code without thinking deeply about the topic at hand.

--
nosy: +rhettinger

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I have this proposal (issue19645) in mind. We can add these method just in 
TestCase.

In any case I'm going to add the ExtraAssertions mixin in test.support in 
maintained versions to help keeping branches in sync.

--

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Why a mixin?

(As an aside, there is a proposal to move all assert methods to a place where 
they can be accessed outside test cases.)

--

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Additional statistics that proves that specified checks are not specific for 
narrow group of tests:

assertHasAttr   121 times in 57 files
assertNotHasAttr 99 times in 31 files
assertIsSubclass243 times in 30 files
assertNotIsSubclass  95 times in 5 files
assertStartsWith131 times in 59 files
assertEndsWith   73 times in 36 files

--

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-05-29 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch adds the ExtraAssertions mix-in that provides additional assert 
methods. These methods provide better failure report than 
assertTrue/assertFalse with a result of corresponding function. For example 
assertStartsWith outputs shorten reprs of the start of the string and prefix.

These checks are quite popular and can be used tens or hundreds times in tests 
(the patch makes tests using new assert methods):

assertHasAttr   121 times
assertNotHasAttr 99 times
assertIsSubclass243 times
assertNotIsSubclass  95 times
assertStartsWith131 times
assertEndsWith   73 times

--
components: Tests
files: extra_assertions.patch
keywords: patch
messages: 266600
nosy: ezio.melotti, michael.foord, r.david.murray, rbcollins, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Additional assert methods for unittest
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file43047/extra_assertions.patch

___
Python tracker 

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