def test_walk_nok_string_dict(): seq = {"a": "b"} message = r"0" with pytest.raises(KeyError, match=message): mc.walk(seq)
def test_walk_ok_empty_string(): empty = '' assert mc.walk(empty) is None
def test_walk_ok_iterator_list(): the_same = iter([1, 2, 3]) seq = [the_same, the_same, the_same] assert mc.walk(seq) == the_same
def test_walk_ok_int_dict(): seq = {0: "a", 1: "b"} assert mc.walk(seq) in seq.values()
def test_walk_nok_wrong_type_generator_expression(): message = r"object of type 'generator' has no len\(\)" with pytest.raises(TypeError, match=message): mc.walk(n for n in range(1234))
def test_walk_ok_function_list(): the_same = print seq = [the_same, the_same, the_same] assert mc.walk(seq) == the_same
def test_walk_ok_string(): string = "abc" step = mc.walk(string) assert len(step) == 1 assert step in string
def test_walk_nok_wrong_type_float(): bad = 3.1415 message = r"object of type 'float' has no len\(\)" with pytest.raises(TypeError, match=message): mc.walk(bad)
def test_walk_ok_empty_dict(): seq = dict() assert mc.walk(seq) is None
def test_walk_ok_empty_tuple(): seq = tuple() assert mc.walk(seq) is None
def test_walk_ok_empty_set(): seq = {} assert mc.walk(seq) is None
def test_walk_ok_empty_list(): seq = [] assert mc.walk(seq) is None
def test_walk_nok_wrong_type_function(): message = r"object of type 'builtin_function_or_method' has no len\(\)" with pytest.raises(TypeError, match=message): mc.walk(print)
def test_walk_nok_wrong_type_none(): bad = None assert mc.walk(bad) is None
def test_walk_ok_string_list(): the_same = "a" seq = [the_same, the_same, the_same] assert mc.walk(seq) == the_same
def test_walk_nok_wrong_type_int(): bad = 42 message = r"object of type 'int' has no len\(\)" with pytest.raises(TypeError, match=message): mc.walk(bad)
def test_walk_ok_range(): a_range = range(42) step = mc.walk(a_range) assert step in a_range assert isinstance(step, int)
def main(argv=None): """Process ... TODO.""" argv = sys.argv[1:] if argv is None else argv verbose = True if "-v" in argv or "--verbose" in argv else False verbose and print(f"No verbose mode implemented") print(walk(argv))
def test_walk_nok_wrong_type_complex(): bad = complex(1, -1) message = r"object of type 'complex' has no len\(\)" with pytest.raises(TypeError, match=message): mc.walk(bad)