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
43bc1f18
Commit
43bc1f18
authored
Apr 15, 2003
by
Walter Dörwald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the test so that it works even when /etc/group has two entries
for the same gid.
parent
66e1e508
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
Lib/test/test_grp.py
Lib/test/test_grp.py
+12
-1
No files found.
Lib/test/test_grp.py
View file @
43bc1f18
...
...
@@ -9,6 +9,7 @@ class GroupDatabaseTestCase(unittest.TestCase):
def
test_values
(
self
):
entries
=
grp
.
getgrall
()
entriesbygid
=
{}
for
e
in
entries
:
self
.
assertEqual
(
len
(
e
),
4
)
...
...
@@ -22,7 +23,17 @@ class GroupDatabaseTestCase(unittest.TestCase):
self
.
assert_
(
isinstance
(
e
.
gr_mem
,
list
))
self
.
assertEqual
(
grp
.
getgrnam
(
e
.
gr_name
),
e
)
self
.
assertEqual
(
grp
.
getgrgid
(
e
.
gr_gid
),
e
)
# The following won't work, because of duplicate entries
# for one gid
# self.assertEqual(grp.getgrgid(e.gr_gid), e)
# instead of this collect all entries for one uid
# and check afterwards
entriesbygid
.
setdefault
(
e
.
gr_gid
,
[]).
append
(
e
)
# check whether the entry returned by getgrgid()
# for each uid is among those from getgrall() for this uid
for
e
in
entries
:
self
.
assert_
(
grp
.
getgrgid
(
e
.
gr_gid
)
in
entriesbygid
[
e
.
gr_gid
])
def
test_errors
(
self
):
self
.
assertRaises
(
TypeError
,
grp
.
getgrgid
)
...
...
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