Did I find the right examples for you? yes no

All Samples(14)  |  Call(10)  |  Derive(0)  |  Import(4)

src/d/j/django-lfs-0.7.7/lfs/plugins.py   django-lfs(Download)
    def get_customer_tax_rate(self):
        """
        Returns the tax rate for the current customer and product.
        """
        from lfs.customer_tax.utils import get_customer_tax_rate
        return get_customer_tax_rate(self.request, self.product)

src/d/j/django-lfs-HEAD/lfs/plugins.py   django-lfs(Download)
    def get_customer_tax_rate(self):
        """
        Returns the tax rate for the current customer and product.
        """
        from lfs.customer_tax.utils import get_customer_tax_rate
        return get_customer_tax_rate(self.request, self.product)

src/d/j/django-lfs-0.7.7/lfs/customer_tax/tests.py   django-lfs(Download)
from lfs.core.models import Country
from lfs.customer_tax.models import CustomerTax
from lfs.customer_tax.utils import get_customer_tax_rate
from lfs.customer.utils import get_or_create_customer
 
    def test_get_customer_tax_rate(self):
        self.customer.selected_shipping_address.country = self.us
        self.customer.selected_shipping_address.save()
        result = get_customer_tax_rate(self.request, self.product)
        self.assertEqual(result, 20.0)
 
        self.customer.selected_shipping_address.country = self.ch
        self.customer.selected_shipping_address.save()
        result = get_customer_tax_rate(self.request, self.product)
        self.customer.selected_shipping_address.country = self.ie
        self.customer.selected_shipping_address.save()
        result = get_customer_tax_rate(self.request, self.product)
        self.assertEqual(result, 10.0)
 
        self.customer.selected_shipping_address.country = self.de
        self.customer.selected_shipping_address.save()
        result = get_customer_tax_rate(self.request, self.product)

src/d/j/django-lfs-HEAD/lfs/customer_tax/tests.py   django-lfs(Download)
from lfs.criteria.models import Criterion
from lfs.customer_tax.models import CustomerTax
from lfs.customer_tax.utils import get_customer_tax_rate
from lfs.customer.utils import get_or_create_customer
 
    def test_get_customer_tax_rate(self):
        self.customer.selected_shipping_address.country = self.us
        self.customer.selected_shipping_address.save()
        result = get_customer_tax_rate(self.request, self.product)
        self.assertEqual(result, 20.0)
        self.customer.selected_shipping_address.country = self.ch
        self.customer.selected_shipping_address.save()
        result = get_customer_tax_rate(self.request, self.product)
        self.assertEqual(result, 20.0)
 
        # clear request cache
        delattr(self.request, 'cached_customer_tax_rate_%s' % self.product.pk)
        self.customer.selected_shipping_address.country = self.ie
        self.customer.selected_shipping_address.save()
        result = get_customer_tax_rate(self.request, self.product)
        self.customer.selected_shipping_address.country = self.de
        self.customer.selected_shipping_address.save()
        result = get_customer_tax_rate(self.request, self.product)
        self.assertEqual(result, 0.0)