laffra / auger

Automated Unittest Generation for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@property methods do not result in generated test cases

NextDesign1 opened this issue · comments

Hi Chris,

Running the following:

import auger

class PropertyTest(object):
    def __init__(self, foo):
        self.bar = foo

    @property
    def first_prop(self):
        return self.bar[0]

    def first_func(self):
        return self.bar[0]

with auger.magic([PropertyTest]):
    p = PropertyTest('Test')
    print p.first_prop
    print p.first_func()

Results in the following generated test cases:

import __main__
import auger
import scratchpad
from scratchpad import PropertyTest
import unittest


class ScratchpadTest(unittest.TestCase):
    def test_first_func(self):
        propertytest_instance = PropertyTest('Test')
        self.assertEquals(
            propertytest_instance.first_func(),
            'T'
        )


if __name__ == "__main__":
    unittest.main()

Note that first_func is tested, however first_prop is not. This was generated using auger 0.1.29.

Merged your pull request and published on PyPi as v 0.1.30

Hi Chris, thanks for that. I'm not seeing it on PyPi however. It still lists the latest version as 0.1.29. Github has been having some issues in the last few days, so perhaps it got lost in the ether?

I uploaded, double-checked, and verified it's now actually showing 0.1.30.

Confirmed. Thanks Chris!