aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/util/dev_test.py
blob: 021b1004679c3041885cf637bdc0b50b244bb95b (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
31
32
###############################################################
# Copyright (c) 2017 ZTE Corporation
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

import pytest

from qtip.base.error import ToBeDoneError
from qtip.util.dev import create_to_be_done


def test_create_to_be_done(faker):
    method = faker.pystr()
    module = faker.pystr()

    tbd = create_to_be_done(method)
    assert callable(tbd)
    with pytest.raises(ToBeDoneError) as excinfo:
        tbd()
    assert excinfo.value.method == method
    assert excinfo.value.module == 'qtip'

    tbd = create_to_be_done(method, module)
    assert callable(tbd)
    with pytest.raises(ToBeDoneError) as excinfo:
        tbd()
    assert excinfo.value.method == method
    assert excinfo.value.module == module