diff options
author | Sergey Nikitin <snikitin@mirantis.com> | 2014-10-23 16:32:33 +0400 |
---|---|---|
committer | Sergey Nikitin <snikitin@mirantis.com> | 2015-01-22 11:57:44 +0300 |
commit | 16774b6d33bda4fe356d14619c843e1d55722e40 (patch) | |
tree | a632af4c817369b3ec54337d528220c8d1987b18 /HACKING.rst | |
parent | 5eb81f46e5381514088e896e322c3f61f8609847 (diff) | |
download | nova-16774b6d33bda4fe356d14619c843e1d55722e40.tar.gz |
Added hacking rule for assertEqual(a in b, True/False).
The following replacements were done in tests to have
clearer messages in case of failure:
- assertEqual(a in b, True) with assertIn(a, b)
- assertEqual(a in b, False) with assertNotIn(a, b)
The error message would now be like:
'abc' not in ['a', 'b', 'c']
rather than:
MismatchError: False != True
Change-Id: I514daca3a470feef5d332a1a319cba15256fc6ea
Diffstat (limited to 'HACKING.rst')
-rw-r--r-- | HACKING.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst index d8850bab6f..234acd4f05 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -49,6 +49,9 @@ Nova Specific Commandments - [N335] Check for usage of deprecated assertRaisesRegexp - [N336] Must use a dict comprehension instead of a dict constructor with a sequence of key-value pairs. - [N337] Don't import translation in tests +- [N338] Change assertEqual(A in B, True), assertEqual(True, A in B), + assertEqual(A in B, False) or assertEqual(False, A in B) to the more specific + assertIn/NotIn(A, B) Creating Unit Tests ------------------- |