Passed
Push — main ( ddff4b...7b3fbc )
by Douglas
04:33
created

tests.model.apis.pubchem_support.test_query_utils   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A TestNav.test_filter() 0 4 1
A TestNav.test() 0 3 1
A TestNav.test_mod() 0 6 1
1
import pytest
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
introduced by
Unable to import 'pytest'
Loading history...
2
3
from mandos.model.apis.pubchem_support import Filter, Flatmap
0 ignored issues
show
Bug introduced by
The name Filter does not seem to exist in module mandos.model.apis.pubchem_support.
Loading history...
Bug introduced by
The name Flatmap does not seem to exist in module mandos.model.apis.pubchem_support.
Loading history...
4
from mandos.model.apis.pubchem_support import JsonNavigator
0 ignored issues
show
Bug introduced by
The name JsonNavigator does not seem to exist in module mandos.model.apis.pubchem_support.
Loading history...
5
6
7
class TestNav:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
8
    def test(self):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
introduced by
Missing function or method docstring
Loading history...
9
        nav = JsonNavigator.create(dict(a=dict(b=1)))
10
        assert (nav / "a" >> "b").contents == [1]
11
12
    def test_filter(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
13
        nav = JsonNavigator.create([dict(a="x", b="y"), dict(a="123", b="456")])
14
        a = nav / Filter.key_equals("b", "y") // "a" // Flatmap.require_only()
0 ignored issues
show
Coding Style Naming introduced by
Variable name "a" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
15
        assert a.contents == ["x"]
16
17
    def test_mod(self):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
introduced by
Missing function or method docstring
Loading history...
18
        nav = JsonNavigator.create([dict(a="x", b="y"), dict(a="123", b="456")])
19
        assert len((nav % "a").contents) == 1
20
        assert dict((nav % "a").contents[0]) == {
21
            "x": dict(a="x", b="y", _landmark=""),
22
            "123": dict(a="123", b="456", _landmark=""),
23
        }
24
25
26
if __name__ == "__main__":
27
    pytest.main()
28