texthero icon indicating copy to clipboard operation
texthero copied to clipboard

Add infer test cases for test indexes

Open ryangawei opened this issue 4 years ago • 5 comments

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.

ryangawei avatar Sep 08 '20 14:09 ryangawei

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,

jbesomi avatar Sep 08 '20 20:09 jbesomi

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.

henrifroese avatar Sep 09 '20 05:09 henrifroese

@jbesomi @henrifroese Just add some comments for explanation and delete the old ones. 👌

ryangawei avatar Sep 10 '20 04:09 ryangawei

Hey @AlfredWGA, what's the current status for this PR?

jbesomi avatar Sep 21 '20 20:09 jbesomi

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?

ryangawei avatar Sep 22 '20 15:09 ryangawei