I have a response from a WS which returns a dictionary of the list. In general, I need to check if none of the lists is empty from the dictionary. However now I need to check some of them, but not all of them, based on the condition.
For example: The result is:
{
'firstList': [{...}], #some data in the list
'secondList': [], #empty list
'thirdList': [{...}], #some data in the list
...
}
So for example, if I have a condition, that the secondList shouldn't be checked with
assert len(response['secondList']) > 0
Then it shouldn't raise an exception, but if I don't have it in the condition, then it should raise an assertion exception.
Any idea what is the best solution for this problem? Maybe another assertion library?
The best would've been to collect all of the exceptions in the end then I could validate them if they are ok/nok.