Exemple #1
0
def test_methods_importer_other_module():
    isok = methods_importer(method_name="mean", modules=[test_1, "other"])
    assert isok == [test_1.mean]
Exemple #2
0
def test_two_more_modules_callable():
    isok = methods_importer(method_name="mean", modules=["numpy", test_1])
    assert isok == [numpy.mean, test_1.mean]
Exemple #3
0
def two_modules_non_callable_test():
    isok = methods_importer(method_name="pi", modules=["numpy", "math"])
    assert isok == []
Exemple #4
0
def test_two_modules_callable():
    isok = methods_importer(method_name="sin", modules=["numpy", "math"])
    assert isok == [numpy.sin, math.sin]
Exemple #5
0
def test_str_module():
    isok = methods_importer(method_name="mean", modules=["numpy"])
    assert isok == [numpy.mean]
Exemple #6
0
def test_incorrect_type():
    with pytest.raises(TypeError):
        methods_importer(method_name="test_callable", modules=[1])
Exemple #7
0
def test_non_callable_method():
    assert isinstance(test_1, types.ModuleType)
    isok = methods_importer(method_name="test_non_callable", modules=[test_1])
    assert isok == []
Exemple #8
0
def test_const():
    assert isinstance(test_1, types.ModuleType)
    isok = methods_importer(method_name="const", modules=[test_1])
    assert isok == []