GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#15)
by Gonzalo
01:17
created

TestNotConformer.test_round_trip()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
2
# -----------------------------------------------------------------------------
3
# Copyright (c) 2015 Yann Lanthony
4
# Copyright (c) 2017-2018 Spyder Project Contributors
5
#
6
# Licensed under the terms of the MIT License
7
# (See LICENSE.txt for details)
8
# -----------------------------------------------------------------------------
9
"""Test suite for qtsass."""
10
11
# Standard library imports
12
from __future__ import absolute_import
13
import unittest
14
from textwrap import dedent
15
16
# Local imports
17
from qtsass.qtsass import NotConformer, QLinearGradientConformer
18
19
20
class TestNotConformer(unittest.TestCase):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
21
22
    qss_str = 'QAbstractItemView::item:!active'
23
    css_str = 'QAbstractItemView::item:_qnot_active'
24
25
    def test_conform_to_css(self):
26
        """NotConformer qss to css."""
27
28
        c = NotConformer()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
29
        self.assertEqual(c.to_css(self.qss_str), self.css_str)
30
31
    def test_conform_to_qss(self):
32
        """NotConformer css to qss."""
33
34
        c = NotConformer()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
35
        self.assertEqual(c.to_qss(self.css_str), self.qss_str)
36
37
    def test_round_trip(self):
38
        """NotConformer roundtrip."""
39
40
        c = NotConformer()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
41
        conformed_css = c.to_css(self.qss_str)
42
        self.assertEqual(c.to_qss(conformed_css), self.qss_str)
43
44
45
class TestQLinearGradientConformer(unittest.TestCase):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
46
47
    css_vars_str = 'qlineargradient($x1, $x2, $y1, $y2, (0 $red, 1 $blue))'
48
    qss_vars_str = (
49
        'qlineargradient(x1:$x1, x2:$x2, y1:$y1, y2:$y2'
50
        'stop: 0 $red, stop: 1 $blue)'
51
    )
52
53
    css_nostops_str = 'qlineargradient(0, 0, 0, 0)'
54
    qss_nostops_str = 'qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0)'
55
56
    css_str = 'qlineargradient(0, 0, 0, 0, (0 red, 1 blue))'
57
    qss_singleline_str = (
58
        'qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0, '
59
        'stop: 0 red, stop: 1 blue)'
60
    )
61
    qss_multiline_str = dedent("""
62
    qlineargradient(
63
        x1: 0,
64
        y1: 0,
65
        x2: 0,
66
        y2: 0,
67
        stop: 0 red,
68
        stop: 1 blue
69
    )
70
    """).strip()
71
    qss_weird_whitespace_str = (
72
        'qlineargradient( x1: 0, y1:0, x2: 0, y2:0, '
73
        '   stop:0 red, stop: 1 blue )'
74
    )
75
76
    def test_does_not_affect_css_form(self):
77
        """QLinearGradientConformer no affect on css qlineargradient func."""
78
79
        c = QLinearGradientConformer()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
80
        self.assertEqual(c.to_css(self.css_str), self.css_str)
81
        self.assertEqual(c.to_qss(self.css_str), self.css_str)
82
83
    def test_conform_singleline_str(self):
84
        """QLinearGradientConformer singleline qss to css."""
85
86
        c = QLinearGradientConformer()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
87
        self.assertEqual(c.to_css(self.qss_singleline_str), self.css_str)
88
89
    def test_conform_multiline_str(self):
90
        """QLinearGradientConformer multiline qss to css."""
91
92
        c = QLinearGradientConformer()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
93
        self.assertEqual(c.to_css(self.qss_multiline_str), self.css_str)
94
95
    def test_conform_weird_whitespace_str(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_conform_weird_whitespace_str does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
96
        """QLinearGradientConformer weird whitespace qss to css."""
97
98
        c = QLinearGradientConformer()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
99
        self.assertEqual(c.to_css(self.qss_weird_whitespace_str), self.css_str)
100
101
    def test_conform_nostops_str(self):
102
        """QLinearGradientConformer qss with no stops to css."""
103
104
        c = QLinearGradientConformer()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
105
        self.assertEqual(c.to_css(self.qss_nostops_str), self.css_nostops_str)
106
107
    def test_conform_vars_str(self):
108
        """QLinearGradientConformer qss with vars to css."""
109
110
        c = QLinearGradientConformer()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
111
        self.assertEqual(c.to_css(self.qss_vars_str), self.css_vars_str)
112