JohnSnowLabs / langtest

Deliver safe & effective language models
http://langtest.org/
Apache License 2.0
470 stars 35 forks source link

`random_age` Class not returning test cases #1020

Closed chakravarthik27 closed 2 months ago

chakravarthik27 commented 2 months ago

This pull request rectifies a bug in the randomize_age Test within langtest. Previously, the function failed to return the generated test cases after processing the input samples.

Details:

The issue stemmed from placing the append statement within the loop iterating over samples. Originally, the append was placed after the loop, resulting in the generated test cases not being added to the perturbed_samples list. The fix involves moving the append statement inside the loop after the test case and generating transformations using randomize_ages(s.original). This ensures that each processed sample's test case is captured before moving on to the next iteration.

Benefits:

This fix guarantees that the randomize_ages function correctly returns the generated test cases, enabling proper execution of the testing suite. By successfully returning the test cases, you can validate your language processing capabilities for handling age-related scenarios within your robustness testing framework.