Coverage for apis_core/utils/test_helpers.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-16 07:42 +0000

1# SPDX-FileCopyrightText: 2023 Birger Schacht 

2# SPDX-License-Identifier: MIT 

3 

4from django.test import TestCase 

5 

6from .helpers import construct_lookup 

7 

8lookups = { 

9 "*foo*": ("__icontains", "foo"), 

10 "foo": ("__icontains", "foo"), 

11 "*foo": ("__iendswith", "foo"), 

12 "foo*": ("__istartswith", "foo"), 

13 '"foo"': ("__iexact", "foo"), 

14} 

15 

16 

17class FilterMethodstest(TestCase): 

18 def test_lookup(self): 

19 for lookup in lookups: 

20 self.assertEqual(construct_lookup(lookup), lookups[lookup])