Skip to content

Conversation

@tamarinvs19
Copy link
Collaborator

@tamarinvs19 tamarinvs19 commented Dec 13, 2022

Description

Fix bug in python code generation for mypy checking. After this fix I cannot reproduce bug #1478

Fixes #1478

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Manual Scenario

See here steps 1-8 with plugin from this build

Expected result: generated tests, for example:

import sys
sys.path.append('..')
import builtins
import types
import sample
import unittest


class TestTopLevelFunctions(unittest.TestCase):
    # region Test suites for executable sample.print_hi
    
    # region
    
    def test_print_hi(self):
        actual = sample.print_hi((1 << 100))
        
        self.assertEqual(None, actual)
    
    def test_print_hi_throws_t(self):
        sample.print_hi(str(b'\xf0\xa3\x91\x96', 'utf-8'))
        
        # raises builtins.UnicodeEncodeError
    # endregion
    
    # endregion
    
    # region Test suites for executable sample.div
    
    # region
    
    def test_div(self):
        actual = sample.div(1, 1)
        
        self.assertEqual(1.0, actual)
    # endregion
    
    # endregion

Checklist (remove irrelevant options):

This is the author self-check list

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • No new warnings
  • All tests pass locally with my changes

@tamarinvs19 tamarinvs19 added ctg-bug Issue is a bug lang-python Issue is related to python support labels Dec 13, 2022
@tamarinvs19 tamarinvs19 merged commit 72264ad into main Dec 15, 2022
@tamarinvs19 tamarinvs19 deleted the tamarinvs19/fix_naming_bug_in_codegen branch December 15, 2022 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ctg-bug Issue is a bug lang-python Issue is related to python support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python test generation error

3 participants