Skip to content

Commit

Permalink
added conversion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Dec 21, 2023
1 parent d1afda6 commit 6ca5d10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/testing/conversiontest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,9 @@ public int MethodA(string dummy, ulong address, int size)
return 0;
}
}

public class ImplicitConversionTest
{
public int TakesInt(int dummy) => dummy;
}
}
8 changes: 7 additions & 1 deletion tests/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

import System
from Python.Test import ConversionTest, MethodResolutionInt, UnicodeString, CodecResetter
from Python.Test import ConversionTest, MethodResolutionInt, UnicodeString, CodecResetter, ImplicitConversionTest
from Python.Runtime import PyObjectConversions
from Python.Runtime.Codecs import RawProxyEncoder

Expand Down Expand Up @@ -752,3 +752,9 @@ def test_explicit_conversion():
assert int(t(123.4)) == 123
with pytest.raises(TypeError):
index(t(123.4))


def test_implicit_conversions():
c = ImplicitConversionTest()

assert c.TakesInt(1.0) == 1

0 comments on commit 6ca5d10

Please sign in to comment.