def get_regular_senate_cycles(state): """ Get the list of election cycles based off Senate class """ senate_cycles = [] for senate_class in ["1", "2", "3"]: if state.upper() in constants.SENATE_CLASSES[senate_class]: senate_cycles += utils.get_senate_cycles(senate_class) return senate_cycles
def test_get_senate_cycles(self): current_cycle = 2018 assert utils.get_senate_cycles('1', current_cycle) == range(2018, 1979, -6) assert utils.get_senate_cycles('2', current_cycle) == range(2020, 1979, -6) assert utils.get_senate_cycles('3', current_cycle) == range(2022, 1979, -6) current_cycle = 2020 assert utils.get_senate_cycles('1', current_cycle) == range(2024, 1979, -6) assert utils.get_senate_cycles('2', current_cycle) == range(2020, 1979, -6) assert utils.get_senate_cycles('3', current_cycle) == range(2022, 1979, -6) current_cycle = 2022 assert utils.get_senate_cycles('1', current_cycle) == range(2024, 1979, -6) assert utils.get_senate_cycles('2', current_cycle) == range(2026, 1979, -6) assert utils.get_senate_cycles('3', current_cycle) == range(2022, 1979, -6)
def test_get_senate_cycles(self): assert utils.get_senate_cycles(1) == range(2018, 1979, -6)