Skip to content

Commit c8fdbcb

Browse files
committed
Adjust a few broken PyTests
1 parent 53375ce commit c8fdbcb

File tree

3 files changed

+11
-49
lines changed

3 files changed

+11
-49
lines changed

src/tests/test_dictionary.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ def test_dict_contains():
6969
"""Test dict support for __contains__."""
7070

7171
ob = Test.PublicDictionaryTest()
72-
items = ob.items
72+
keys = ob.items.Keys
7373

74-
assert '0' in items
75-
assert '1' in items
76-
assert '2' in items
77-
assert '3' in items
78-
assert '4' in items
74+
assert '0' in keys
75+
assert '1' in keys
76+
assert '2' in keys
77+
assert '3' in keys
78+
assert '4' in keys
7979

80-
assert not ('5' in items)
81-
assert not ('-1' in items)
80+
assert not ('5' in keys)
81+
assert not ('-1' in keys)
8282

8383
def test_dict_abuse():
8484
"""Test dict abuse."""
@@ -100,17 +100,6 @@ def test_dict_abuse():
100100
with pytest.raises(TypeError):
101101
Test.PublicArrayTest.__getitem__(0, 0)
102102

103-
with pytest.raises(TypeError):
104-
Test.PublicArrayTest.__setitem__(0, 0, 0)
105-
106-
with pytest.raises(TypeError):
107-
desc = Test.PublicArrayTest.__dict__['__getitem__']
108-
desc(0, 0)
109-
110-
with pytest.raises(TypeError):
111-
desc = Test.PublicArrayTest.__dict__['__setitem__']
112-
desc(0, 0, 0)
113-
114103
def test_InheritedDictionary():
115104
"""Test class that inherited from IDictionary."""
116105
items = Test.InheritedDictionaryTest()

tests/test_exceptions.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,12 @@ def test_raise_instance_exception_with_args():
120120
assert isinstance(exc, NullReferenceException)
121121
assert exc.Message == 'Aiiieee!'
122122

123-
124123
def test_managed_exception_propagation():
125124
"""Test propagation of exceptions raised in managed code."""
126-
from System import Decimal, OverflowException
127-
128-
with pytest.raises(OverflowException):
129-
Decimal.ToInt64(Decimal.MaxValue)
125+
from System import Decimal, DivideByZeroException
130126

127+
with pytest.raises(DivideByZeroException):
128+
Decimal.Divide(1, 0)
131129

132130
def test_managed_exception_conversion():
133131
"""Test conversion of managed exceptions."""

tests/test_indexer.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -333,31 +333,6 @@ def test_double_indexer():
333333
ob["wrong"] = "wrong"
334334

335335

336-
def test_decimal_indexer():
337-
"""Test Decimal indexers."""
338-
ob = Test.DecimalIndexerTest()
339-
340-
from System import Decimal
341-
max_d = Decimal.Parse("79228162514264337593543950335")
342-
min_d = Decimal.Parse("-79228162514264337593543950335")
343-
344-
assert ob[max_d] is None
345-
346-
ob[max_d] = "max_"
347-
assert ob[max_d] == "max_"
348-
349-
ob[min_d] = "min_"
350-
assert ob[min_d] == "min_"
351-
352-
with pytest.raises(TypeError):
353-
ob = Test.DecimalIndexerTest()
354-
ob["wrong"]
355-
356-
with pytest.raises(TypeError):
357-
ob = Test.DecimalIndexerTest()
358-
ob["wrong"] = "wrong"
359-
360-
361336
def test_string_indexer():
362337
"""Test String indexers."""
363338
ob = Test.StringIndexerTest()

0 commit comments

Comments
 (0)