forked from kljohann/genpybind-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noconvert_test.py
28 lines (23 loc) · 932 Bytes
/
noconvert_test.py
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
import pytest
import pynoconvert as m
def test_overloading():
assert m.called_with_double(5.0) is True
assert m.called_with_double(5) is False
def test_conversion():
assert m.convert(5.0) == 5.0
assert m.convert(5) == 5.0
def test_noconvert():
assert m.noconvert(5.0) == 5.0
with pytest.raises(TypeError, match="incompatible function arguments"):
m.noconvert(5)
def test_noconvert_first():
assert m.noconvert_first(5.0, 7.0) == 12.0
with pytest.raises(TypeError, match="incompatible function arguments"):
m.noconvert_first(5, 7.0)
assert m.noconvert_first(5.0, 7) == 12.0
def test_noconvert_numeric():
assert m.noconvert_numeric(5.0, 7.0) == 12.0
with pytest.raises(TypeError, match="incompatible function arguments"):
m.noconvert_numeric(5, 7.0)
with pytest.raises(TypeError, match="incompatible function arguments"):
m.noconvert_numeric(5.0, 7)