Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
modified existing method out parameter tests
existing tests are passing bogus values to force matching the method signature
these tests should pass with the recent method binder fix, without passing the bogus values
  • Loading branch information
eirannejad committed Jan 14, 2022
commit 1964a494ccc9b0bd7db2bef028ba0193cd7d969a
28 changes: 4 additions & 24 deletions tests/test_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,7 @@ def test_params_method_with_lists():

def test_string_out_params():
"""Test use of string out-parameters."""
result = MethodTest.TestStringOutParams("hi", "there")
assert isinstance(result, tuple)
assert len(result) == 2
assert result[0] is True
assert result[1] == "output string"

result = MethodTest.TestStringOutParams("hi", None)
result = MethodTest.TestStringOutParams("hi")
assert isinstance(result, tuple)
assert len(result) == 2
assert result[0] is True
Expand All @@ -297,16 +291,12 @@ def test_string_ref_params():

def test_value_out_params():
"""Test use of value type out-parameters."""
result = MethodTest.TestValueOutParams("hi", 1)
result = MethodTest.TestValueOutParams("hi")
assert isinstance(result, tuple)
assert len(result) == 2
assert result[0] is True
assert result[1] == 42

# None cannot be converted to a value type like int, long, etc.
with pytest.raises(TypeError):
MethodTest.TestValueOutParams("hi", None)


def test_value_ref_params():
"""Test use of value type byref parameters."""
Expand All @@ -323,13 +313,7 @@ def test_value_ref_params():

def test_object_out_params():
"""Test use of object out-parameters."""
result = MethodTest.TestObjectOutParams("hi", MethodTest())
assert isinstance(result, tuple)
assert len(result) == 2
assert result[0] is True
assert isinstance(result[1], System.Exception)

result = MethodTest.TestObjectOutParams("hi", None)
result = MethodTest.TestObjectOutParams("hi")
assert isinstance(result, tuple)
assert len(result) == 2
assert result[0] is True
Expand All @@ -353,16 +337,12 @@ def test_object_ref_params():

def test_struct_out_params():
"""Test use of struct out-parameters."""
result = MethodTest.TestStructOutParams("hi", System.Guid.NewGuid())
result = MethodTest.TestStructOutParams("hi")
assert isinstance(result, tuple)
assert len(result) == 2
assert result[0] is True
assert isinstance(result[1], System.Guid)

# None cannot be converted to a value type like a struct
with pytest.raises(TypeError):
MethodTest.TestValueRefParams("hi", None)


def test_struct_ref_params():
"""Test use of struct byref parameters."""
Expand Down