Completed
Branch master (87ccc1)
by Chris
10:18
created

tests.phonetic.test_phonetic_pt   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 1
1
# -*- coding: utf-8 -*-
2
3
# Copyright 2018 by Christopher C. Little.
4
# This file is part of Abydos.
5
#
6
# Abydos is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# Abydos is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with Abydos. If not, see <http://www.gnu.org/licenses/>.
18
19
"""abydos.tests.test_phonetic_pt.
20
21
This module contains unit tests for abydos.phonetic.pt
22
"""
23
24
from __future__ import unicode_literals
25
26
import unittest
27
28
from abydos.phonetic.pt import soundex_br
29
30
31
class SoundexBRTestCases(unittest.TestCase):
32
    """Test SoundexBR functions.
33
34
    test cases for abydos.phonetic.soundex_br
35
    """
36
37
    def test_soundex_br(self):
38
        """Test abydos.phonetic.soundex_br."""
39
        # Base case
40
        self.assertEqual(soundex_br(''), '0000')
41
42
        # Examples given at https://github.com/danielmarcelino/SoundexBR
43
        self.assertEqual(soundex_br('Ana Karolina Kuhnen'), 'A526')
44
        self.assertEqual(soundex_br('Ana Carolina Kuhnen'), 'A526')
45
        self.assertEqual(soundex_br('Ana Karolina'), 'A526')
46
        self.assertEqual(soundex_br('João Souza'), 'J220')
47
        self.assertEqual(soundex_br('Dilma Vana Rousseff'), 'D451')
48
        self.assertEqual(soundex_br('Dilma Rousef'), 'D456')
49
        self.assertEqual(soundex_br('Aécio Neves'), 'A251')
50
        self.assertEqual(soundex_br('Aecio Neves'), 'A251')
51
        self.assertEqual(soundex_br('HILBERT'), 'I416')
52
        self.assertEqual(soundex_br('Heilbronn'), 'E416')
53
        self.assertEqual(soundex_br('Gauss'), 'G200')
54
        self.assertEqual(soundex_br('Kant'), 'C530')
55
56
        # Tests to complete coverage
57
        self.assertEqual(soundex_br('Wasser'), 'V260')
58
        self.assertEqual(soundex_br('Cici'), 'S200')
59
        self.assertEqual(soundex_br('Gerard'), 'J663')
60
        self.assertEqual(soundex_br('Yglesias'), 'I242')
61
        self.assertEqual(soundex_br('Cici', zero_pad=False), 'S2')
62
63
64
if __name__ == '__main__':
65
    unittest.main()
66