def test_user_counts_to_kplus_reaches(self):
     self.assertEqual(ReachPoint.user_counts_to_kplus_reaches({}, 3),
                      [0, 0, 0])
     self.assertEqual(ReachPoint.user_counts_to_kplus_reaches({3: 1}, 3),
                      [1, 0, 0])
     self.assertEqual(ReachPoint.user_counts_to_kplus_reaches({3: 2}, 3),
                      [1, 1, 0])
     self.assertEqual(
         ReachPoint.user_counts_to_kplus_reaches({
             3: 1,
             2: 1
         }, 3), [2, 0, 0])
     self.assertEqual(
         ReachPoint.user_counts_to_kplus_reaches(
             {
                 3: 1,
                 2: 1,
                 1: 2,
                 4: 3,
                 5: 4
             }, 3),
         [5, 3, 2],
     )
    def true_reach_by_spend(self, spend: float, max_frequency: int = 1) -> ReachPoint:
        """Returns the true reach obtained for a given spend vector.

        Args:
            spend:  The hypothetical amount spent.
            max_frequency:  The maximum frequency for which to report reach.
        Returns:
            A ReachPoint representing the true reach that would have been
            obtained for this spend.
        """
        user_counts = self._publisher_data.user_counts_by_spend(spend)
        impressions = sum(user_counts.values())
        reach = ReachPoint.user_counts_to_kplus_reaches(user_counts, max_frequency)
        return ReachPoint([impressions], reach, [spend])