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.

TestLevenShtein   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A test_zero_words_should_zero() 0 5 1
A test_first_longer_equal_one() 0 5 1
A test_second_longer_equal_one() 0 9 1
A test_same_word_should_zero() 0 5 1
1
"""This module is for testing Levenshtein distance."""
2
3
4
import sys
5
6
from unittest import TestCase
7
8
LEVENSHTEIN = sys.modules["Rainmeter.completion.levenshtein"]
9
10
11
class TestLevenShtein(TestCase):
12
    """Test for the levenshtein module using unittest."""
13
14
    def test_same_word_should_zero(self):
15
        """We use the same word there should be no difference required."""
16
        diff = LEVENSHTEIN.levenshtein("hello", "hello")
17
18
        self.assertEqual(diff, 0)
19
20
    def test_zero_words_should_zero(self):
21
        """Special case with same word but both are empty."""
22
        diff = LEVENSHTEIN.levenshtein("", "")
23
24
        self.assertEqual(diff, 0)
25
26
    def test_first_longer_equal_one(self):
27
        """Same word base but missing characters."""
28
        diff = LEVENSHTEIN.levenshtein("hello", "hell")
29
30
        self.assertEqual(diff, 1)
31
32
    def test_second_longer_equal_one(self):
33
        """
34
        Reversed case of the missing character.
35
36
        Method should work in both ways and not return a negative difference.
37
        """
38
        diff = LEVENSHTEIN.levenshtein("hell", "hello")
39
40
        self.assertEqual(diff, 1)
41