Skip to content

Commit

Permalink
Improved ATR code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
gbeced committed Apr 22, 2018
1 parent 52625b3 commit 8f79eca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions testcases/technical_atr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from pyalgotrade.technical import atr
from pyalgotrade import bar
from pyalgotrade.dataseries import bards
from pyalgotrade import dataseries


class TestCase(common.TestCase):
Expand Down Expand Up @@ -62,3 +63,8 @@ def testStockChartsATRAdjusted(self):
self.assertEqual(atrDS[-1], None)
else:
self.assertEqual(common.safe_round(atrDS[-1], 2), round(expected[i]/2, 2))

def testInvalidDataSeries(self):
with self.assertRaisesRegexp(Exception, "barDataSeries must be a dataseries.bards.BarDataSeries instance"):
ds = dataseries.SequenceDataSeries()
atrDS = atr.ATR(ds, 14, True)

0 comments on commit 8f79eca

Please sign in to comment.