tests.model.test_query_utils.TestNav.test_mod()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
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.query_utils import JsonNavigator, Fns
4
5
6
class TestNav:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
7
    def test(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...
8
        nav = JsonNavigator.create(dict(a=dict(b=1)))
9
        assert (nav / "a" >> "b").contents == [1]
10
11
    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...
12
        nav = JsonNavigator.create([dict(a="x", b="y"), dict(a="123", b="456")])
13
        a = nav / Fns.key_equals("b", "y") // "a" // Fns.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...
14
        assert a.contents == ["x"]
15
16
    def test_mod(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...
17
        nav = JsonNavigator.create([dict(a="x", b="y"), dict(a="123", b="456")])
18
        assert len((nav % "a").contents) == 1
19
        assert dict((nav % "a").contents[0]) == {
20
            "x": dict(a="x", b="y", _landmark=""),
21
            "123": dict(a="123", b="456", _landmark=""),
22
        }
23
24
25
if __name__ == "__main__":
26
    pytest.main()
27