Beispiel #1
0
class TestFiniteRatesEVSE(TestEVSE):
    def setUp(self):
        self.evse = FiniteRatesEVSE('0001', [0, 8, 16, 24, 32])

    def test_allowable_pilot_signals(self):
        self.assertEqual(self.evse.allowable_pilot_signals, [0, 8, 16, 24, 32])

    def test_allowable_pilot_signals_unsorted(self):
        evse2 = FiniteRatesEVSE('0002', [32, 16, 8, 24, 0])
        self.assertEqual(evse2.allowable_pilot_signals, [0, 8, 16, 24, 32])

    def test_allowable_pilot_signals_duplicates(self):
        evse3 = FiniteRatesEVSE('0003', [0, 8, 8, 24, 16, 24, 32])
        self.assertEqual(evse3.allowable_pilot_signals, [0, 8, 16, 24, 32])

    def test_allowable_pilot_signals_no_zero(self):
        evse4 = FiniteRatesEVSE('0004', [8, 24, 16, 32])
        self.assertEqual(evse4.allowable_pilot_signals, [0, 8, 16, 24, 32])

    def test_set_pilot_has_ev_invalid_rate(self):
        ev = create_autospec(EV)
        self.evse.plugin(ev)
        with self.assertRaises(InvalidRateError):
            self.evse.set_pilot(17.2, 240, 5)

    def test_set_pilot_no_ev_invalid_rate(self):
        with self.assertRaises(InvalidRateError):
            self.evse.set_pilot(17.2, 240, 5)
Beispiel #2
0
class TestFiniteRatesEVSE(TestEVSE):
    def setUp(self):
        super().setUp()
        self.evse = FiniteRatesEVSE("0001", [0, 8, 16, 24, self.max_rate])

    def test_max_rate_finite_rates_evse(self):
        self.assertEqual(self.evse.max_rate, self.max_rate)

    def test_min_rate_finite_rates_evse(self):
        self.assertEqual(self.evse.min_rate, 8)

    def test_allowable_pilot_signals(self):
        self.assertEqual(
            self.evse.allowable_pilot_signals, [0, 8, 16, 24, self.max_rate]
        )

    def test_allowable_pilot_signals_unsorted(self):
        evse2 = FiniteRatesEVSE("0002", [self.max_rate, 16, 8, 24, 0])
        self.assertEqual(evse2.allowable_pilot_signals, [0, 8, 16, 24, self.max_rate])

    def test_allowable_pilot_signals_duplicates(self):
        evse3 = FiniteRatesEVSE("0003", [0, 8, 8, 24, 16, 24, self.max_rate])
        self.assertEqual(evse3.allowable_pilot_signals, [0, 8, 16, 24, self.max_rate])

    def test_allowable_pilot_signals_no_zero(self):
        evse4 = FiniteRatesEVSE("0004", [8, 24, 16, self.max_rate])
        self.assertEqual(evse4.allowable_pilot_signals, [0, 8, 16, 24, self.max_rate])

    def test_set_pilot_has_ev_almost_over_finite_rate(self):
        self._set_pilot_has_ev_valid_rate_helper(
            self.mid_rate + self.atol - self.atol / 1e2
        )

    def test_set_pilot_has_ev_almost_under_finite_rate(self):
        self._set_pilot_has_ev_valid_rate_helper(
            self.mid_rate - self.atol + self.atol / 1e2
        )

    def test_set_pilot_has_ev_invalid_rate(self):
        ev = create_autospec(EV)
        self.evse.plugin(ev)
        with self.assertRaises(InvalidRateError):
            self.evse.set_pilot(17.2, 240, 5)

    def test_set_pilot_no_ev_invalid_rate(self):
        self._set_pilot_no_ev_invalid_rate_helper(17.2)

    def test_set_pilot_no_ev_barely_over_finite_rate(self):
        self._set_pilot_no_ev_invalid_rate_helper(
            self.max_rate + self.atol + self.atol / 1e2
        )

    def test_set_pilot_no_ev_barely_under_finite_rate(self):
        self._set_pilot_no_ev_invalid_rate_helper(
            self.max_rate - self.atol - self.atol / 1e2
        )
Beispiel #3
0
class TestFiniteRatesEVSE(TestEVSE):
    def setUp(self):
        self.evse = FiniteRatesEVSE('0001', [0, 8, 16, 24, 32])

    def test_set_pilot_has_ev_invalid_rate(self):
        ev = create_autospec(EV)
        self.evse.plugin(ev)
        with self.assertRaises(InvalidRateError):
            self.evse.set_pilot(17.2, 240, 5)

    def test_set_pilot_no_ev_invalid_rate(self):
        with self.assertRaises(InvalidRateError):
            self.evse.set_pilot(17.2, 240, 5)