Exemple #1
0
    def test_attach_meta_to_results(self):
        presidential_results = render._select_presidential_state_results()
        serialized_results = render._serialize_results(
            presidential_results, render.PRESIDENTIAL_STATE_SELECTIONS)

        self.assertEqual(serialized_results['KS'][0]['meta']['first_results'],
                         '8:00 PM')
Exemple #2
0
    def test_calculate_electoral_college(self):
        state_results = render._select_presidential_state_results()
        electoral_totals = render._calculate_electoral_votes(state_results)

        dem_votes = electoral_totals['Dem']
        gop_votes = electoral_totals['GOP']

        self.assertEqual(dem_votes + gop_votes, 538)
Exemple #3
0
 def test_presidential_state_selection(self):
     results = render._select_presidential_state_results()
     results_length = len(results)
     self.assertEqual(results_length, 237)
Exemple #4
0
    def test_serialization(self):
        presidential_results = render._select_presidential_state_results()
        serialized_results = render._serialize_results(
            presidential_results, render.PRESIDENTIAL_STATE_SELECTIONS)

        self.assertEqual(len(serialized_results.keys()), 51)