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)
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)
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)