def test_count_add_capacity(self): """ Count addition with consumed_capacity """ count = Count(4, 2, Capacity.create_read({'CapacityUnits': 3})) count2 = Count(5, 3, Capacity.create_read({'CapacityUnits': 2})) ret = count + count2 self.assertEqual(ret, 9) self.assertEqual(ret.scanned_count, 5) self.assertEqual(ret.consumed_capacity.read, 5)
def test_capacity_factories(self): """ Capacity.create_(read|write) factories """ cap = Capacity.create_read({'CapacityUnits': 3}) self.assertEqual(cap.read, 3) self.assertEqual(cap.write, 0) cap = Capacity.create_write({'CapacityUnits': 3}) self.assertEqual(cap.write, 3) self.assertEqual(cap.read, 0)
def test_count_add_none_capacity(self): """ Count addition with one None consumed_capacity """ cap = Capacity.create_read({'CapacityUnits': 3}) count = Count(4, 2) count2 = Count(5, 3, cap) ret = count + count2 self.assertEqual(ret, 9) self.assertEqual(ret.scanned_count, 5) self.assertEqual(ret.consumed_capacity, cap)