ENH: Well formed exception for any value passed to OrderStyle

This commit adds support for arbitrary objects in addition to NaN
and infinity values. The object well be returned in string format
as part of the error message.
This commit is contained in:
Delaney Granizo-Mackenzie
2014-08-26 14:02:28 -04:00
parent 15f33d3e9d
commit 5488da0dc2
2 changed files with 43 additions and 38 deletions
+13 -1
View File
@@ -62,7 +62,19 @@ class ExecutionStyleTestCase(TestCase):
for delta in range(1, 10)
]
INVALID_PRICES = [(-1,), (-1.0,), (0 - epsilon,), (float('nan'),)]
class ArbitraryObject():
def __str__(self):
return """This should yield a bad order error when
passed as a stop or limit price."""
INVALID_PRICES = [
(-1,),
(-1.0,),
(0 - epsilon,),
(float('nan'),),
(float('inf'),),
(ArbitraryObject(),),
]
def setUp(self):
setup_logger(self)