texthero
texthero copied to clipboard
Add infer test cases for test indexes
This PR add codes to generate test cases for each function according their input HeroSeries. Only functions with one HeroSeries input will be generated with test case. Exceptions can be manually added, for example,
test_case_exceptions = {}
for case in (
test_cases_nlp
+ test_cases_preprocessing
+ test_cases_representation
+ test_cases_visualization
):
test_case_exceptions[case[0]] = case
Then functions within test_case_exceptions
will not be given a generated test case.
To omit some functions for testing, put them under func_white_list
,
func_white_list = set(
[s for s in inspect.getmembers(visualization, inspect.isfunction)]
)
See #179.
Thanks, great! 🎉 🎉
The file still contains a lot of commented lines that appear to be unnecessary. Can you please clean it a bit? Also, we might need to update the comments by explaining the new changes as well as removing the unnecessary ones, can you please have a detailed look at that too?
Regards,
Looks great! I think that if some other developer now adds a function, he might get a weird error if this file automatically generates a test case and it maybe fails (e.g. because it needs additional arguments and it's not 100% obvious to everyone where to implement that). That's why I think it would be great if you could add some explanation for other developers in the file. E.g.
"""
The tests below Blabla...
"""
That's also what we did in _types
, hoping it will help others fully understand the code.
@jbesomi @henrifroese Just add some comments for explanation and delete the old ones. 👌
Hey @AlfredWGA, what's the current status for this PR?
Hey @AlfredWGA, what's the current status for this PR?
I haven't come up with any idea on how to further avoid defining test case manually. Maybe leave it to another PR in the future?