New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #1201 Converted test_nocasedict.py from unittest to pytest and changed test_function decorator #1237
Conversation
291e581
to
67366ef
Compare
Details: - Migrated all test cases in test_nocasedict.py from unittest to py.test. - Expanded the test cases to be quite complete. - In the (non-published) docstring of NocaseDict.update(), added information about the order of updates. This is relevant, now that NocaseDict preserves order. This is for internal clarity, as the NocaseDict description is not published. Signed-off-by: Andreas Maier <maiera@de.ibm.com>
Details: The current checking in the pytest_extensions.test_function decorator verified that the warning has been issued exactly once. In some cases (e.g. deprecated ordering comparisons for NocaseDict), the same warning message and location is issued more than once (because the NocaseDict ordering operators delegate to each other). The resulting warning in the Pythn warning system shows only one warning, because it merges warnings with the same type, message and location. However, pytest captures the warnings before that merge and thus shows more than one warning. This change relaxes the test for exactly one warning to verify that one or more warnings have been issued (of the specified type). An additional difficulty was that when a testcase specifies both an exception type and a warning type, this is really a bit overspecified, because the warning could have been issued before the exception was raised, or not. In theory, one could require that the testcases have this knowledge, but again it seems a bit overspecified. This change therefore removes the check for warnings, when an exception has also been specified in the test case. Signed-off-by: Andreas Maier <maiera@de.ibm.com>
67366ef
to
606c26e
Compare
pywbem/_nocasedict.py
Outdated
Update the dictionary from key/value pairs. If an item for a key | ||
exists in the dictionary, its value is updated. If an item for a key | ||
does not exist, it is added to the dictionary at the end. | ||
The provided keys and values are not copied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence takes some thinking. We mean that the values from the dictionary are used without copying them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE.
Changed the sentence to: "The provided keys and values are stored in the dictionary without being copied."
pywbem/_nocasedict.py
Outdated
|
||
Each positional argument can be: | ||
|
||
* an object with a method `items()` that returns an | ||
:term:`py:iterable` of tuples containing key and value. | ||
A NocaseDict or other dict object would match that requirement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't understand this sentence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to give a hint what this kind of positional argument is used for, but I guess it is not necessary. Removed the sentence, and also the similar sentence in the next item.
DONE.
pywbem/_nocasedict.py
Outdated
|
||
* an object without such a method, that is an :term:`py:iterable` of | ||
tuples containing key and value. | ||
A list of tuples (key,value) would match that requirement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Not sure what you are trying to say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of editorial comments. Otherwise OK
Signed-off-by: Andreas Maier <maiera@de.ibm.com>
The new commit addresses all review comments. |
For details, see the commit messages (two commits).
Ready for review and merge.