tests.test_utils moduleΒΆ
Test the generic helpers of the private utility module.
- tests.test_utils.test_exception_chain_ends_on_a_loop()[source]ΒΆ
Two exceptions naming each other are each yielded once.
- tests.test_utils.test_exception_chain_prefers_the_cause()[source]ΒΆ
The cause an exception was raised from wins over the one it replaced.
- tests.test_utils.test_flatten_collapses_nested_iterables()[source]ΒΆ
Every nesting level is walked, strings and bytes staying whole.
- tests.test_utils.test_deep_merge_merges_dicts_and_takes_every_other_value_from_the_overlay()[source]ΒΆ
- tests.test_utils.SET_NESTED_PATHS: tuple[tuple[tuple[str, ...], object], ...] = ((('orchard', 'apple', 'count'), 3), (('orchard', 'apple', 'color'), 'red'), (('orchard', 'pear'), {'count': 1}), (('orchard', 'pear'), {'color': 'green'}), (('orchard', 'pear', 'count'), 2), (('garden',), 'tomato'), (('garden', 'basil'), True), (('orchard', 'apple'), ['fuji', 'gala']), (('orchard', 'apple', 'count'), 4), (('barn',), {'hay': {'bales': 10}}), (('barn', 'hay'), {'straw': 2}))ΒΆ
Paths and values covering every case of a merge: a fresh path, a shared prefix, two dictionaries merging, a dictionary replacing a value, and the reverse.
- tests.test_utils.test_set_nested_matches_merging_one_path_trees()[source]ΒΆ
Setting each path in place builds the tree the one-path merges built.
- tests.test_utils.test_parse_bool(text, expected)[source]ΒΆ
The spellings read the same whatever their case and surrounding blanks.
- tests.test_utils.test_boolean_states_match_configparser()[source]ΒΆ
The copy holds the spellings the standard library reads, no more.
- tests.test_utils.BLANK_TREE: dict[str, object] = {'city': 'Lyon', 'forecast': {'rain': None, 'sky': '', 'wind': {}}, 'harbor': {'boats': 0, 'docks': [], 'flags': False}, 'lake': None, 'orchard': {}, 'river': ''}ΒΆ
A tree holding a blank value of each kind, at the top and one level down.