Skip to content

Required import is not added when functions returns class from a library #1824

@tyuldashev

Description

@tyuldashev

Description

When UTBot generates tests for methods which return class from the library it doesn't add import statement to test file, so such test always fails.

To Reproduce

Steps to reproduce the behavior:

import json


def some_json():
    return json.JSONDecoder
  1. Use code above to reproduce the problem
  2. Generate test for that code
  3. Run generated tests

Expected behavior

Generated test runs without issues

Actual behavior

Generated test fails because import of json is not added to test file.

Visual proofs (screenshots, logs, images)

image

Metadata

Metadata

Assignees

Labels

comp-codegenIssue is related to code generatorctg-bugIssue is a buglang-pythonIssue is related to python supportstatus-verifiedBug fix is verified

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions