'How to specify parameters and test another function from a different file
I have a test where certain functions are tested in a file. In that file it calls out another function from another file. What can I add to the test so that the test coverage works?
def parse_location
location = extracted_data.get_field(field.location)
if self.field_present("location2"):
location2 = extracted_data.get_field(field.location2)
if self.get_words_out("location2"): #this is located in another file and circleci coverage fails
location2 = parse_word(location2, self.get_words_out("location2")
correct_location = location + " " + location2
How can I add get_words_out("location2") to the test? My pytest looks like:
("location, location2, expected"
[
(Portugal, Porto, Portugal Porto),
]
)
What I would like to have:
("location, location2, parse_location2, expected"
[
(Portugal, Porto not needed, not needed, Portugal Porto),
]
)
Having a file where the specific words are listed and called to be parse out works. But I need to have those words called from within the test for the test coverage in circleci not to fail.
Sorry for the messy format.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
