diff --git a/tests/pipeline/test_term.py b/tests/pipeline/test_term.py index eebcbd41..ce86b24a 100644 --- a/tests/pipeline/test_term.py +++ b/tests/pipeline/test_term.py @@ -18,6 +18,7 @@ from zipline.pipeline.data.testing import TestingDataSet from zipline.pipeline.term import AssetExists, NotSpecified from zipline.pipeline.expression import NUMEXPR_MATH_FUNCS from zipline.utils.numpy_utils import ( + bool_dtype, datetime64ns_dtype, float64_dtype, int64_dtype, @@ -335,10 +336,19 @@ class ObjectIdentityTestCase(TestCase): SomeFactor(dtype=1) def test_latest_on_different_dtypes(self): - self.assertIsInstance(TestingDataSet.bool_col.latest, Filter) - self.assertIsInstance(TestingDataSet.float_col.latest, Factor) - self.assertIsInstance(TestingDataSet.datetime_col.latest, Factor) - self.assertIsInstance(TestingDataSet.int_col.latest, Factor) + factor_dtypes = (int64_dtype, float64_dtype, datetime64ns_dtype) + for column in TestingDataSet.columns: + if column.dtype == bool_dtype: + self.assertIsInstance(column.latest, Filter) + elif column.dtype in factor_dtypes: + self.assertIsInstance(column.latest, Factor) + else: + self.fail( + "Unknown dtype %s for column %s" % (column.dtype, column) + ) + # These should be the same value, plus this has the convenient + # property of correctly handling `NaN`. + self.assertIs(column.missing_value, column.latest.missing_value) def test_failure_timing_on_bad_missing_values(self):