DEV: Add parameter_space test decorator.

This commit is contained in:
Scott Sanderson
2016-02-12 21:21:19 -05:00
parent 9c448b5238
commit 94c02c710b
2 changed files with 82 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
"""
Tests for our testing utilities.
"""
from itertools import product
from unittest import TestCase
from zipline.utils.test_utils import parameter_space
class TestParameterSpace(TestCase):
x_args = [1, 2]
y_args = [3, 4]
@classmethod
def setUpClass(cls):
cls.xy_invocations = []
@classmethod
def tearDownClass(cls):
# This is the only actual test here.
assert cls.xy_invocations == list(product(cls.x_args, cls.y_args))
@parameter_space(x=x_args, y=y_args)
def test_xy(self, x, y):
self.xy_invocations.append((x, y))
def test_nothing(self):
# Ensure that there's at least one "real" test in the class, or else
# our {setUp,tearDown}Class won't be called if, for example,
# `parameter_space` returns None.
pass