Skip to content

Commit ce40fb1

Browse files
committed
Add overload tests from #131
1 parent a343b34 commit ce40fb1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/tests/test_method.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,3 +743,29 @@ def test_we_can_bind_to_encoding_get_string():
743743

744744
data = ''.join(data)
745745
assert data == 'Some testing string'
746+
747+
748+
def test_wrong_overload():
749+
"""Test regression in which implicit conversion caused the wrong types
750+
to be used. See #131 for issue. Fixed by #137, #151"""
751+
752+
# Used to return `50L`
753+
res = System.Math.Abs(50.5)
754+
assert res == 50.5
755+
assert type(res) == float
756+
757+
res = System.Math.Abs(-50.5)
758+
assert res == 50.5
759+
assert type(res) == float
760+
761+
res = System.Math.Max(50.5, 50.1)
762+
assert res == 50.5
763+
assert type(res) == float
764+
765+
res = System.Math.Max(System.Double(10.5), System.Double(50.5))
766+
assert res == 50.5
767+
assert type(res) == float # Should it return a System.Double?
768+
769+
res = System.Math.Max(System.Double(50.5), 50.1)
770+
assert res == 50.5
771+
assert type(res) == float

0 commit comments

Comments
 (0)