def test_write_leaderboard(self):
        expected_path = os.path.join("test_results", "leaderboard.xls")
        leaderboard = sut.calculate(self.test_data)

        sut.write(leaderboard, "test_results", "leaderboard.xls", "Leaderboard")

        self.assertTrue(os.path.isfile(expected_path))
    def test_write_and_load_leaderboard(self):
        exp_path = os.path.join("test_results", "leaderboard.xls")
        exp_sheetname = "Leaderboard"
        leaderboard = sut.calculate(self.test_data)
        sut.write(leaderboard, "test_results", "leaderboard.xls", exp_sheetname)

        loaded_leaderboard = pd.ExcelFile(exp_path).parse(exp_sheetname)

        pd.testing.assert_frame_equal(loaded_leaderboard, self.expected_leaderboard)
예제 #3
0
 def test_leaderboard_is_sorted_by_points(self):
     result = leaderboard.calculate(self.test_data)
     self.assertEqual(list(result["Name"]),
                      ["peter", "juli", "nick", "tom"])
     self.assertEqual(list(result["Points"]), [40, 34, 30, 13])
예제 #4
0
 def test_leaderboard_sums_up_by_name(self):
     result = leaderboard.calculate(self.test_data)
     self.assertEqual(set(result["Points"]), set([13, 34, 40, 30]))
예제 #5
0
 def test_leaderboard_groups_by_name(self):
     result = leaderboard.calculate(self.test_data)
     self.assertEqual(set(result["Name"]),
                      set(["tom", "nick", "juli", "peter"]))