summaryrefslogtreecommitdiffstats
path: root/deluge/tests/test_ui_gtk3.py
blob: e6d025c7c1377db04bf70d1576d5950fe8b61d45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#

import sys
from unittest import mock

import pytest


@pytest.mark.gtkui
class TestGTK3Common:
    def setUp(self):
        sys.modules['gi.repository'] = mock.MagicMock()

    def tearDown(self):
        pass

    def test_cmp(self):
        from deluge.ui.gtk3.common import cmp

        assert cmp(None, None) == 0
        assert cmp(1, None) == 1
        assert cmp(0, None) == 1
        assert cmp(None, 7) == -1
        assert cmp(None, 'bar') == -1
        assert cmp('foo', None) == 1
        assert cmp('', None) == 1