Coverage for polar/checkout/guard.py: 80%

8 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 12:42 +0000

1from typing import TYPE_CHECKING, TypeIs 

2from uuid import UUID 

3 

4from polar.models import Checkout, Product, ProductPrice 

5 

6if TYPE_CHECKING: 6 ↛ 8line 6 didn't jump to line 8 because the condition on line 6 was never true

7 

8 class ProductCheckout(Checkout): 

9 product_id: UUID 

10 product: Product 

11 product_price_id: UUID 

12 product_price: ProductPrice 

13else: 

14 ProductCheckout = Checkout 

15 

16 

17def has_product_checkout(checkout: Checkout) -> TypeIs[ProductCheckout]: 

18 return checkout.product is not None and checkout.product_price is not None