browncoat-ninjas/nimoy

Cannot get either example of with where: working

Closed this issue · 2 comments

Version: 1.1.1
Python version 3.8.5

Reproduction Test Case:

[source,python]

from nimoy.specification import Specification

class MySpec(Specification):

def my_feature_method(self):
    with given:
        a = value_of_a
        b = value_of_b

    with expect:
        (a * b) == expected_value

    with where:
        value_of_a = [1, 2]
        value_of_b = [10, 20]
        expected_value = [10, 40]

Expected Behavior:
2 tests run and succeeds

Actual Behavior:
Exception is thrown: TypeError: expected some sort of slice, but got <_ast.Constant object at 0x7fa52026aac0>

I get this error if I use either the Data as Matrix or Data as List example from the docs. Any other example from the docs works just fine. But whenever I try using a with where, the test throws this exception.

The error mentions AST, so I'm not sure if this is related to #29. I'm not on Python 3.9, though (3.8.5)

I tried running the test with power assertions on, but that produced a different error.

Thanks for reporting this. This error could be possibly be a Python version compatibility issue, but I'm not sure. I'll check it out

noamt commented

Yes, the issue is indeed the version compatibility.
I now see that you are on Python 3.8, which is supported up to version 1.0.2, including.
Nimoy 1.1.1 requires Python >= 3.9