Test Failed
Push — master ( ea7733...1b036d )
by Swen
02:19
created

LocalizedBulkTestCase.test_localized_bulk_insert()   A

Complexity

Conditions 2

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 17
rs 9.4285
1
import json
0 ignored issues
show
Unused Code introduced by
The import json seems to be unused.
Loading history...
2
3
from django.db import models
0 ignored issues
show
Configuration introduced by
The import django.db could not be resolved.

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.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
4
from django.conf import settings
0 ignored issues
show
Configuration introduced by
The import django.conf could not be resolved.

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.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
Unused Code introduced by
Unused settings imported from django.conf
Loading history...
5
from django.test import TestCase
0 ignored issues
show
Configuration introduced by
The import django.test could not be resolved.

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.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
6
7
from localized_fields.fields import LocalizedField
8
9
from .data import get_init_values
0 ignored issues
show
Unused Code introduced by
Unused get_init_values imported from data
Loading history...
10
from .fake_model import get_fake_model
11
12
13
class LocalizedBulkTestCase(TestCase):
0 ignored issues
show
Coding Style introduced by
This class has no __init__ method.
Loading history...
14
    """Tests bulk operations with data structures provided
15
    by the django-localized-fields library."""
16
17
    @staticmethod
18
    def test_localized_bulk_insert():
19
        model = get_fake_model(
20
            'BulkInsertModel',
21
            {
22
                'name': LocalizedField(),
23
                'score': models.IntegerField()
24
            }
25
        )
26
27
        objects = model.objects.bulk_create([
0 ignored issues
show
Unused Code introduced by
The variable objects seems to be unused.
Loading history...
28
            model(name={'en': 'english name 1', 'ro': 'romanian name 1'}, score=1),
29
            model(name={'en': 'english name 2', 'ro': 'romanian name 2'}, score=2),
30
            model(name={'en': 'english name 3', 'ro': 'romanian name 3'}, score=3)
31
        ])
32
33
        assert model.objects.all().count() == 3
34