Passed
Push — master ( 73195b...c2efe9 )
by Ramon
58s queued 11s
created

tests.functions.test_is_optional_type   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestIsOptionalType.test_is_optional_type() 0 6 1
1
from typing import Optional, Union
2
from unittest import TestCase
3
4
from typish import (
5
    NoneType,
6
)
7
from typish.functions._is_optional_type import is_optional_type
8
9
10
class TestIsOptionalType(TestCase):
11
    def test_is_optional_type(self):
12
        self.assertTrue(is_optional_type(Optional[str]))
13
        self.assertTrue(is_optional_type(Union[str, None]))
14
        self.assertTrue(is_optional_type(Union[str, NoneType]))
15
        self.assertTrue(not is_optional_type(str))
16
        self.assertTrue(not is_optional_type(Union[str, int]))
17