I have a generator method that is building a large set of test criteria, I know i can make a non class method to be called, but I much rather have the parameter building method be part of my test class. is there a way to do this?
here is a simple description of what I want to do:
class MyUnitTestClass(TestCase):
@staticmethod
def generate_scenarios():
yield ('this_is_my_test', 1, 2)
@parameterized.expand(generate_scenarios())
def test_scenario(self, test_name, input, expected_output)
self.assertEquals(input+input, expected_output)
right now I have do do the following:
def generate_scenarios():
yield ('this_is_my_test', 1, 2)
class MyUnitTestClass(TestCase):
@parameterized.expand(generate_scenarios())
def test_scenario(self, test_name, input, expected_output)
self.assertEquals(input+input, expected_output)
TL;DR: I want my scenario generate_scenarios method to be within the test class that is calling it.