'Test Exception when the template cannot be parsed.'

def test_bad_template(self):

    bad = Template('{{    x    -    12    }}', self.hass)
    duration = '01:00'
    sensor1 = HistoryStatsSensor(self.hass, 'test', 'on', bad, None, duration, 'time', 'Test')
    sensor2 = HistoryStatsSensor(self.hass, 'test', 'on', None, bad, duration, 'time', 'Test')
    before_update1 = sensor1._period
    before_update2 = sensor2._period
    sensor1.update_period()
    sensor2.update_period()
    self.assertEqual(before_update1, sensor1._period)
    self.assertEqual(before_update2, sensor2._period)
