'Test the process of determining the next payment details during a transaction'

def test_next_payment(self):

    def set_transaction_data(trans_price, trans_quantity, payment_price, payment_quantity):
        self.transaction._transferred_price = trans_price
        self.transaction._transferred_quantity = trans_quantity
        self.payment._transferee_price = payment_price
        self.payment._transferee_quantity = payment_quantity
        self.transaction._payments = [self.payment]
    self.assertEqual(self.transaction.next_payment(True, 1, incremental=False), Quantity(30, 'MC'))
    self.assertEqual(self.transaction.next_payment(False, 2, incremental=False), Price(3000, 'BTC'))
    self.assertEqual(self.transaction.next_payment(True, 1, incremental=True), Quantity(1, 'MC'))
    self.assertEqual(self.transaction.next_payment(False, 2, incremental=True), Price(2, 'BTC'))
    set_transaction_data(Price(1, 'BTC'), Quantity(1, 'MC'), Price(1, 'BTC'), Quantity(1, 'MC'))
    self.assertEqual(self.transaction.next_payment(True, 0.1, incremental=True), Quantity(0.2, 'MC'))
    set_transaction_data(Price(3000, 'BTC'), Quantity(29, 'MC'), Price(1, 'BTC'), Quantity(1, 'MC'))
    self.assertEqual(self.transaction.next_payment(True, 1, incremental=True), Quantity(1, 'MC'))
    set_transaction_data(Price(2900, 'BTC'), Quantity(30, 'MC'), Price(1, 'BTC'), Quantity(1, 'MC'))
    self.assertEqual(self.transaction.next_payment(False, 1, incremental=True), Price(100, 'BTC'))
    set_transaction_data(Price(2999, 'BTC'), Quantity(29, 'MC'), Price(2999, 'BTC'), Quantity(1, 'MC'))
    self.assertEqual(self.transaction.next_payment(True, 1, incremental=True), Quantity(1, 'MC'))
    set_transaction_data(Price(2999, 'BTC'), Quantity(29, 'MC'), Price(1, 'BTC'), Quantity(29, 'MC'))
    self.assertEqual(self.transaction.next_payment(False, 1, incremental=True), Price(1, 'BTC'))
