FreeCAD

Форк
0
/
StringHasher.py 
47 строк · 2.2 Кб
1
# SPDX-License-Identifier: LGPL-2.1-or-later
2

3
# ***************************************************************************
4
# *   Copyright (c) 2023 Mario Passaglia <mpassaglia[at]cbc.uba.ar>         *
5
# *                                                                         *
6
# *   This file is part of FreeCAD.                                         *
7
# *                                                                         *
8
# *   FreeCAD is free software: you can redistribute it and/or modify it    *
9
# *   under the terms of the GNU Lesser General Public License as           *
10
# *   published by the Free Software Foundation, either version 2.1 of the  *
11
# *   License, or (at your option) any later version.                       *
12
# *                                                                         *
13
# *   FreeCAD is distributed in the hope that it will be useful, but        *
14
# *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
15
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      *
16
# *   Lesser General Public License for more details.                       *
17
# *                                                                         *
18
# *   You should have received a copy of the GNU Lesser General Public      *
19
# *   License along with FreeCAD. If not, see                               *
20
# *   <https://www.gnu.org/licenses/>.                                      *
21
# *                                                                         *
22
# **************************************************************************/
23

24
import FreeCAD
25
import unittest
26

27

28
class TestStringHasher(unittest.TestCase):
29
    def setUp(self):
30
        self.strHash = FreeCAD.StringHasher()
31
        self.strID = self.strHash.getID("A")
32

33
    def testInit(self):
34
        with self.assertRaises(TypeError):
35
            FreeCAD.StringHasher(0)
36

37
    def testGetID(self):
38
        with self.assertRaises(ValueError):
39
            self.strHash.getID(0)
40

41
    def testStringHasherIsSame(self):
42
        with self.assertRaises(TypeError):
43
            self.strHash.isSame(0)
44

45
    def testStringIDIsSame(self):
46
        with self.assertRaises(TypeError):
47
            self.strID.isSame(0)
48

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.