Muream / maya-stubs

Stubs for Autodesk Maya
MIT License
41 stars 4 forks source link

Implement Unit Tests #21

Open Muream opened 10 months ago

Muream commented 10 months ago

With the amount of function and classes generated, it's really hard to keep track of regressions and also to figure out which signatures are accurate or not

Writing tests for each individual function is also an unrealistic amount of work.

it would be very nice to have an automated way to test if all the possible way to call a function given its typed signature result in something valid in maya.

For example, given this stub function

def some_function(a: int, b: bool | str) -> bool:
    ...

we'd have generate these function calls to be tested:

def test_some_function():
    assert isinstance(some_function(0, True), bool)
    assert isinstance(some_function(0, "Hello"), bool)

Not really sure if the tests should be generated and written to some actual python files or if all of that inference should just be done at runtime

Muream commented 10 months ago

Hypothesis seems like a perfect candidate for this