Closed
Description
Description
For some reason UTbot Python generates many very similar tests for one function.
To Reproduce
Steps to reproduce the behavior:
- Clone
langchain
project - https://github.com/hwchase17/langchain - Open
langchain/input.py
file - Generate tests for
get_color_mapping
function with default settings
Expected behavior
Some tests are supposed to be generated.
Actual behavior
According to comment UTBot generates hundreds or thousands of very similar tests. Fortunately they are limited by maxTestsPerMethod
setting. Even though this improves path coverage it doesn't look practically useful. Could we improve it or that's by design?
Here is couple of such test:
# Actual number of generated tests (2588) exceeds per-method limit (50)
# The limit can be configured in '{HOME_DIR}/.utbot/settings.properties' with 'maxTestsPerMethod' property
def test_get_color_mapping2(self):
"""
items = builtins.list[builtins.str]
"""
actual = langchain.input.get_color_mapping(['Get mapping for items to a support color.', '€', 'pythön', 'foo'])
self.assertEqual({'Get mapping for items to a support color.': 'blue', '€': 'yellow', 'pythön': 'pink', 'foo': 'green', }, actual)
def test_get_color_mapping3(self):
"""
items = builtins.list[builtins.str]
"""
actual = langchain.input.get_color_mapping(['abcdefghijklmnopqrst', 'Get mapping for items to a support color.'])
self.assertEqual({'abcdefghijklmnopqrst': 'blue', 'Get mapping for items to a support color.': 'yellow', }, actual)
Additional context
For some reason it's reproducible only inside the project. If I copy/paste the same file into separate project it generates just couple tests as I would expect.
Metadata
Metadata
Assignees
Type
Projects
Status
Done