コード例 #1
0
ファイル: test_keltner_bands.py プロジェクト: yurmor/pyti
 def test_adx_invalid_data(self):
     period = 6
     self.high_data.append(0)
     with self.assertRaises(Exception) as cm:
         keltner_bands.band_width(self.high_data, self.low_data, period)
     expected = ("Error: mismatched data lengths, check to ensure that all input data is the same length and valid")
     self.assertEqual(str(cm.exception), expected)
コード例 #2
0
 def test_bandwidth_invalid_period(self):
     period = 128
     with self.assertRaises(Exception) as cm:
         keltner_bands.band_width(self.high_data, self.low_data, period)
     expected = "Error: data_len < period"
     self.assertEqual(str(cm.exception), expected)
コード例 #3
0
 def test_bandwidth_period_6(self):
     period = 6
     bw = keltner_bands.band_width(self.high_data, self.low_data, period)
     np.testing.assert_array_equal(bw, self.bandwidth_period_6_expected)