def testMonthlyPayrollRows(self):
        """Rows should contain monthly totals mapping for each user."""
        self._setupMonthlyTotals()

        # 1 row for each user, plus totals row.
        self.assertEquals(len(self.rows), 2 + 1)

        for row in self.rows[:-1]:  # Exclude totals row.
            work_total = Decimal('55.00')
            self.assertEquals(row['work_total'], work_total)

            # Last entry is summary of status.
            self.assertEquals(len(row['billable']), 1 + 1)
            for entry in row['billable']:
                self.assertEquals(entry['hours'], Decimal('45.00'))
                self.assertEquals(entry['percent'], Decimal('45.00') / work_total * 100)

            # Last entry is summary of status.
            self.assertEquals(len(row['nonbillable']), 1 + 1)
            for entry in row['nonbillable']:
                self.assertEquals(entry['hours'], Decimal('10.00'))
                self.assertEquals(entry['percent'], Decimal('10.00') / work_total * 100)

            self.assertEquals(len(row['leave']), 2 + 1)
            sick_index = self.labels['leave'].index(self.sick.name)
            vacation_index = self.labels['leave'].index(self.vacation.name)
            self.assertEquals(
                row['leave'][sick_index]['hours'], Decimal('40.00'))
            self.assertEquals(
                row['leave'][sick_index]['percent'],
                Decimal('40.00') / Decimal('60.00') * 100)
            self.assertEquals(
                row['leave'][vacation_index]['hours'], Decimal('20.00'))
            self.assertEquals(
                row['leave'][vacation_index]['percent'],
                Decimal('20.00') / Decimal('60.00') * 100)
            self.assertEquals(row['leave'][-1]['hours'], Decimal('60.00'))
            self.assertEquals(row['leave'][-1]['percent'], Decimal('100.00'))
            self.assertEquals(row['grand_total'], Decimal('115.00'))
dataset/ETHPy150Open caktus/django-timepiece/timepiece/reports/tests/test_payroll.py/PayrollTest.testMonthlyPayrollRows/original