Skip to content

Fixed test generation for generics #1846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 26, 2023
Merged

Fixed test generation for generics #1846

merged 3 commits into from
Feb 26, 2023

Conversation

tochilinak
Copy link
Member

Description

Fixes #1822.

Tests for that example are still not generated, but now for completely different reason (opened issue #1845).

How to test

Manual tests

Python code with generics:

from typing import TypeVar, Generic
from logging import Logger

T = TypeVar('T', bound=bool)
U = TypeVar('U', str, object)


class LoggedVar(Generic[T]):
    def __init__(self, value: T, name: str) -> None:
        self.name = name
        self.value = value

    def set(self, new: T) -> None:
        self.value = new

    def get(self, x: U):
        return self.value, x


def func(x: T, y: U):
    if x:
        return y
    else:
        return 100

Tests are generated for all listed functions.

Self-check list

Check off the item if the statement is true. Hint: [x] is a marked item.

Please do not delete the list or its items.

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

@tochilinak tochilinak added comp-fuzzing Issue is related to the fuzzing lang-python Issue is related to python support ctg-bug-fix PR is fixing a bug labels Feb 24, 2023
@tochilinak tochilinak self-assigned this Feb 24, 2023
@tochilinak tochilinak merged commit c03b4d6 into main Feb 26, 2023
@tochilinak tochilinak deleted the tochilinak/generics branch February 26, 2023 18:11
sofurihafe pushed a commit that referenced this pull request Feb 27, 2023
* First version of test generation for generics

* Fix bug with constructors from different ancestors

* Fixed case with type parameters of a function
@alisevych alisevych added this to the 2023.03 Release milestone Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-fuzzing Issue is related to the fuzzing ctg-bug-fix PR is fixing a bug lang-python Issue is related to python support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot generate test for Python generics: No seed candidates generated
3 participants