Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2b79fdfc
Commit
2b79fdfc
authored
Apr 03, 2010
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split out large test function
parent
e9da81c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
Lib/test/test_structmembers.py
Lib/test/test_structmembers.py
+21
-16
No files found.
Lib/test/test_structmembers.py
View file @
2b79fdfc
...
...
@@ -12,13 +12,15 @@ ts=test_structmembersType(False, 1, 2, 3, 4, 5, 6, 7, 8,
9.99999
,
10.1010101010
)
class
ReadWriteTests
(
unittest
.
TestCase
):
def
test_types
(
self
):
def
test_bool
(
self
):
ts
.
T_BOOL
=
True
self
.
assertEquals
(
ts
.
T_BOOL
,
True
)
ts
.
T_BOOL
=
False
self
.
assertEquals
(
ts
.
T_BOOL
,
False
)
self
.
assertRaises
(
TypeError
,
setattr
,
ts
,
'T_BOOL'
,
1
)
def
test_byte
(
self
):
ts
.
T_BYTE
=
CHAR_MAX
self
.
assertEquals
(
ts
.
T_BYTE
,
CHAR_MAX
)
ts
.
T_BYTE
=
CHAR_MIN
...
...
@@ -26,6 +28,7 @@ class ReadWriteTests(unittest.TestCase):
ts
.
T_UBYTE
=
UCHAR_MAX
self
.
assertEquals
(
ts
.
T_UBYTE
,
UCHAR_MAX
)
def
test_short
(
self
):
ts
.
T_SHORT
=
SHRT_MAX
self
.
assertEquals
(
ts
.
T_SHORT
,
SHRT_MAX
)
ts
.
T_SHORT
=
SHRT_MIN
...
...
@@ -33,6 +36,7 @@ class ReadWriteTests(unittest.TestCase):
ts
.
T_USHORT
=
USHRT_MAX
self
.
assertEquals
(
ts
.
T_USHORT
,
USHRT_MAX
)
def
test_int
(
self
):
ts
.
T_INT
=
INT_MAX
self
.
assertEquals
(
ts
.
T_INT
,
INT_MAX
)
ts
.
T_INT
=
INT_MIN
...
...
@@ -40,6 +44,7 @@ class ReadWriteTests(unittest.TestCase):
ts
.
T_UINT
=
UINT_MAX
self
.
assertEquals
(
ts
.
T_UINT
,
UINT_MAX
)
def
test_long
(
self
):
ts
.
T_LONG
=
LONG_MAX
self
.
assertEquals
(
ts
.
T_LONG
,
LONG_MAX
)
ts
.
T_LONG
=
LONG_MIN
...
...
@@ -47,21 +52,21 @@ class ReadWriteTests(unittest.TestCase):
ts
.
T_ULONG
=
ULONG_MAX
self
.
assertEquals
(
ts
.
T_ULONG
,
ULONG_MAX
)
## T_LONGLONG and T_ULONGLONG may not be present on some platforms
if
hasattr
(
ts
,
'T_LONGLONG'
):
ts
.
T_LONGLONG
=
LLONG_MAX
self
.
assertEquals
(
ts
.
T_LONGLONG
,
LLONG_MAX
)
ts
.
T_LONGLONG
=
LLONG_MIN
self
.
assertEquals
(
ts
.
T_LONGLONG
,
LLONG_MIN
)
ts
.
T_ULONGLONG
=
ULLONG_MAX
self
.
assertEquals
(
ts
.
T_ULONGLONG
,
ULLONG_MAX
)
## make sure these will accept a plain int as well as a long
ts
.
T_LONGLONG
=
3
self
.
assertEquals
(
ts
.
T_LONGLONG
,
3
)
ts
.
T_ULONGLONG
=
4
self
.
assertEquals
(
ts
.
T_ULONGLONG
,
4
)
@
unittest
.
skipUnless
(
hasattr
(
ts
,
"T_LONGLONG"
),
"long long not present"
)
def
test_longlong
(
self
):
ts
.
T_LONGLONG
=
LLONG_MAX
self
.
assertEquals
(
ts
.
T_LONGLONG
,
LLONG_MAX
)
ts
.
T_LONGLONG
=
LLONG_MIN
self
.
assertEquals
(
ts
.
T_LONGLONG
,
LLONG_MIN
)
ts
.
T_ULONGLONG
=
ULLONG_MAX
self
.
assertEquals
(
ts
.
T_ULONGLONG
,
ULLONG_MAX
)
## make sure these will accept a plain int as well as a long
ts
.
T_LONGLONG
=
3
self
.
assertEquals
(
ts
.
T_LONGLONG
,
3
)
ts
.
T_ULONGLONG
=
4
self
.
assertEquals
(
ts
.
T_ULONGLONG
,
4
)
class
TestWarnings
(
unittest
.
TestCase
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment