Passed
Pull Request — master (#13)
by Ramon
01:32
created

tests.classes.test_literal_meta   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 66.67 %

Importance

Changes 0
Metric Value
eloc 11
dl 12
loc 18
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestLiteralMeta.test_from_literal() 8 8 1
A TestLiteralMeta.test_str() 2 2 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
from unittest import TestCase
2
3
from typish import LiteralAlias
4
5
6 View Code Duplication
class TestLiteralMeta(TestCase):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7
    def test_from_literal(self):
8
9
        class LiteralMock:
10
            __args__ = (42,)
11
12
        alias = LiteralAlias.from_literal(LiteralMock)
13
14
        self.assertTrue(isinstance(42, alias))
15
16
    def test_str(self):
17
        self.assertEqual('Literal[42]', str(LiteralAlias[42]))
18