Doctest with an imported dictionary in a function that uses only some key-value paris

14 views Asked by At

I have the following problem: I have a file in which I have a dictionary, that looks like this:

d = {"a": 3, "b": 4, "c": 5, "d": 6, "e": 4}

I imported this dictionary in another file, in which I have the main function definitions. I would like to test these functions via doctests. For the sake of simplicity, I take the first function.

def fun_1(d["a], d["b"], d["e"]):
 return_val = d["a"] * d["b"] + d["c"]
 return return_val

How can I implement a doctest test specifically using the three key-value pairs?

I tried to insert random values such into the doctest test case. Nevertheless, it did not work

0

There are 0 answers