-
Notifications
You must be signed in to change notification settings - Fork 748
Support clr.GetClrType() - as in IronPython #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
464ce08
443e307
0eb4ca0
8feacd8
1e373b4
68f3fab
6fa6b89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,6 +352,26 @@ def test_clr_add_reference(): | |
with pytest.raises(FileNotFoundException): | ||
AddReference("somethingtotallysilly") | ||
|
||
def test_clr_get_clr_type(): | ||
"""Test clr.GetClrType().""" | ||
from clr import GetClrType | ||
import System | ||
from System import IComparable | ||
from System import ArgumentException | ||
assert GetClrType(System.String).FullName == "System.String" | ||
comparable = GetClrType(IComparable) | ||
assert comparable.FullName == "System.IComparable" | ||
assert comparable.IsInterface | ||
assert GetClrType(int).FullName == "System.Int32" | ||
assert GetClrType(str).FullName == "System.String" | ||
assert GetClrType(float).FullName == "System.Double" | ||
dblarr = System.Array[System.Double] | ||
assert GetClrType(dblarr).FullName == "System.Double[]" | ||
|
||
with pytest.raises(TypeError): | ||
GetClrType(1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you compare also against types, not instance of types? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you elaborate, what kind of comparison I should add? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GetClrType(int), GetClrType(str) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check lines 365-367 in the diff :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see now let's wait for @filmor to approve |
||
with pytest.raises(TypeError): | ||
GetClrType("thiswillfail") | ||
|
||
def test_assembly_load_thread_safety(): | ||
from Python.Test import ModuleTest | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add the test to invoke the ArgumentException error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done