Skip to content

Commit a997f7f

Browse files
committed
added enum to int tests
1 parent 78e591d commit a997f7f

File tree

1 file changed

+48
-5
lines changed

1 file changed

+48
-5
lines changed

tests/test_enum.py

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ def test_ulong_enum():
8686
assert Test.ULongEnum.Two == Test.ULongEnum(2)
8787

8888

89-
def test_simple_enum_to_int():
90-
from System import DayOfWeek
91-
assert int(DayOfWeek.Sunday) == 0
92-
93-
9489
def test_long_enum_to_int():
9590
assert int(Test.LongEnum.Max) == 9223372036854775807
9691
assert int(Test.LongEnum.Min) == -9223372036854775808
@@ -178,6 +173,54 @@ def test_enum_conversion():
178173
Test.FieldTest().EnumField = 1
179174

180175

176+
def test_byte_enum_to_int():
177+
"""Test byte enum to int"""
178+
assert bool(Test.ByteEnum.Zero) == 0
179+
assert bool(Test.ByteEnum.One) == 1
180+
181+
182+
def test_sbyte_enum_to_int():
183+
"""Test sbyte enum to int"""
184+
assert bool(Test.SByteEnum.Zero) == 0
185+
assert bool(Test.SByteEnum.One) == 1
186+
187+
188+
def test_short_enum_to_int():
189+
"""Test short enum to int"""
190+
assert bool(Test.ShortEnum.Zero) == 0
191+
assert bool(Test.ShortEnum.One) == 1
192+
193+
194+
def test_ushort_enum_to_int():
195+
"""Test ushort enum to int"""
196+
assert bool(Test.UShortEnum.Zero) == 0
197+
assert bool(Test.UShortEnum.One) == 1
198+
199+
200+
def test_int_enum_to_int():
201+
"""Test int enum to int"""
202+
assert bool(Test.IntEnum.Zero) == 0
203+
assert bool(Test.IntEnum.One) == 1
204+
205+
206+
def test_uint_enum_to_int():
207+
"""Test uint enum to int"""
208+
assert bool(Test.UIntEnum.Zero) == 0
209+
assert bool(Test.UIntEnum.One) == 1
210+
211+
212+
def test_long_enum_to_int():
213+
"""Test long enum to int"""
214+
assert bool(Test.LongEnum.Zero) == 0
215+
assert bool(Test.LongEnum.One) == 1
216+
217+
218+
def test_ulong_enum_to_int():
219+
"""Test ulong enum to int"""
220+
assert bool(Test.ULongEnum.Zero) == 0
221+
assert bool(Test.ULongEnum.One) == 1
222+
223+
181224
def test_byte_enum_to_bool():
182225
"""Test byte enum to bool"""
183226
assert bool(Test.ByteEnum.Zero) == False

0 commit comments

Comments
 (0)