3 ms·
It's still not that easy to assert on some of the keys in a dict but not others, especially if you only want to assert on some of the keys nested inside that ke
by calpaterson 6y ago
It's still not that easy to assert on some of the keys in a dict but not others, especially if you only want to assert on some of the keys nested inside that key, and so on. There are a few other cases that perhaps don't come to mind straight away, many to do with having complex rules for what is allowed to be in another thing.
- BerislavLopac 6y agoI'm not sure what do you mean exactly... If it's something like: assert foo["bar"] == 123 assert foo["baz"]["bam"]["boo"] = "abc" I don't see how is that made easier (and less ambiguous) in hamcrest-style assertions...
- calpaterson 6y agoThe case is more like when you want to assert against some of the contents of a dictionary but not all (say 60% of a 30 key dict), and not all those assertions are based on == (and it's a multilevel nested dict). There's no particurly terse why to write an example I'm afraid.