| Total Complexity | 7 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from django.conf import settings |
||
| 10 | class LocalizedQuerySetTestCase(TestCase): |
||
| 11 | """Tests query sets with models containing :see:LocalizedField.""" |
||
| 12 | |||
| 13 | Model = None |
||
| 14 | |||
| 15 | @classmethod |
||
| 16 | def setUpClass(cls): |
||
| 17 | """Creates the test models in the database.""" |
||
| 18 | |||
| 19 | super(LocalizedQuerySetTestCase, cls).setUpClass() |
||
| 20 | |||
| 21 | cls.Model = get_fake_model( |
||
| 22 | { |
||
| 23 | 'title': LocalizedField(), |
||
| 24 | } |
||
| 25 | ) |
||
| 26 | |||
| 27 | @classmethod |
||
| 28 | def test_assign_raw_dict(cls): |
||
| 29 | inst = cls.Model() |
||
| 30 | inst.title = dict(en='Bread', ro='Paine') |
||
| 31 | inst.save() |
||
| 32 | |||
| 33 | inst = cls.Model.objects.get(pk=inst.pk) |
||
| 34 | assert inst.title.en == 'Bread' |
||
| 35 | assert inst.title.ro == 'Paine' |
||
| 36 | |||
| 37 | @classmethod |
||
| 38 | def test_assign_raw_dict_update(cls): |
||
| 39 | inst = cls.Model.objects.create( |
||
| 40 | title=dict(en='Bread', ro='Paine')) |
||
| 41 | |||
| 42 | cls.Model.objects.update( |
||
| 43 | title=dict(en='Beer', ro='Bere')) |
||
| 44 | |||
| 45 | inst = cls.Model.objects.get(pk=inst.pk) |
||
| 46 | assert inst.title.en == 'Beer' |
||
| 47 | assert inst.title.ro == 'Bere' |
||
| 48 |
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.pyfiles in your module folders. Make sure that you place one file in each sub-folder.