From 2431aaefb58a16ec6b45c2801091936567fb096c Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Tue, 10 May 2016 16:56:32 -0400 Subject: [PATCH] BUG: Fix bad error message for element_of. It referred to the wrong method name (`is_element`). --- tests/pipeline/test_classifier.py | 4 ++-- zipline/pipeline/classifiers/classifier.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/pipeline/test_classifier.py b/tests/pipeline/test_classifier.py index de111e97..3eb02020 100644 --- a/tests/pipeline/test_classifier.py +++ b/tests/pipeline/test_classifier.py @@ -434,7 +434,7 @@ class ClassifierTestCase(BasePipelineTestCase): errmsg = str(e.exception) expected = ( "Found self.missing_value ('not in the array') in choices" - " supplied to C.is_element().\n" + " supplied to C.element_of().\n" "Missing values have NaN semantics, so the requested" " comparison would always produce False.\n" "Use the isnull() method to check for missing values.\n" @@ -447,7 +447,7 @@ class ClassifierTestCase(BasePipelineTestCase): class C(Classifier): dtype = dtype_ - missing_value = '' + missing_value = dtype.type('1') inputs = () window_length = 0 diff --git a/zipline/pipeline/classifiers/classifier.py b/zipline/pipeline/classifiers/classifier.py index 05a99593..6a64e106 100644 --- a/zipline/pipeline/classifiers/classifier.py +++ b/zipline/pipeline/classifiers/classifier.py @@ -246,7 +246,7 @@ class Classifier(RestrictedDTypeMixin, ComputableTerm): if self.missing_value in choices: raise ValueError( "Found self.missing_value ({mv!r}) in choices supplied to" - " {typename}.is_element().\n" + " {typename}.{meth_name}().\n" "Missing values have NaN semantics, so the" " requested comparison would always produce False.\n" "Use the isnull() method to check for missing values.\n" @@ -254,6 +254,7 @@ class Classifier(RestrictedDTypeMixin, ComputableTerm): mv=self.missing_value, typename=(type(self).__name__), choices=sorted(choices), + meth_name=self.element_of.__name__, ) )