from tests.factories.charge_factory import ChargeFactory default_dict = { "amount": 10.0, "currency": "USD", "description": "Test charge" } charge_factory = ChargeFactory(default_dict) charge = charge_factory.create() # Prints: Charge(amount=10.0, currency='USD', description='Test charge') print(charge)
from tests.factories.charge_factory import ChargeFactory default_dict = { "amount": 10.0, "currency": "USD", "description": "Test charge" } charge_factory = ChargeFactory(default_dict) charge = charge_factory.create(amount=15.0, description="Override test charge") # Prints: Charge(amount=15.0, currency='USD', description='Override test charge') print(charge)In this example, we create a ChargeFactory instance with a default_dict as before. However, this time we call the create() method with additional arguments to override specific values for the resulting Charge object. We pass in 15.0 for the amount argument and "Override test charge" for the description argument. The resulting Charge object is printed for verification. Based on the package import statement, it appears that ChargeFactory is part of a larger package for testing purposes, potentially related to software infrastructure or APIs.