Skip to content

Commit 5784e52

Browse files
committed
-
1 parent 276cd1c commit 5784e52

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

source_py3/python_toolbox/context_management/abstract_context_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def __subclasshook__(cls, candidate_class):
3030
if cls is AbstractContextManager:
3131
return (
3232
hasattr(candidate_class, '__enter__') and
33-
candidate_class.__enter__ is not none and
33+
candidate_class.__enter__ is not None and
3434
hasattr(candidate_class, '__exit__') and
35-
candidate_class.__exit__ is not none
35+
candidate_class.__exit__ is not None
3636
)
3737
else:
3838
return NotImplemented

source_py3/test_python_toolbox/test_temp_file_tools/test_create_temp_folder.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,15 @@ def test_parent_folder():
9797
assert str(tf2).startswith(str(tf1))
9898

9999
def test_chmod():
100-
with create_temp_folder(chomd=0o777) as liberal_temp_folder, \
101-
create_temp_folder(chomd=0o000) as conservative_temp_folder:
102-
liberal_temp_folder.stat().st_mode & 0o777
103-
1 / 0 # blocktodo write this test
100+
with create_temp_folder(chmod=0o777) as liberal_temp_folder, \
101+
create_temp_folder(chmod=0o000) as conservative_temp_folder:
102+
# Doing a very weak test of chmod because not everything is supported
103+
# on Windows.
104+
assert (liberal_temp_folder.stat().st_mode & 0o777) > \
105+
(conservative_temp_folder.stat().st_mode & 0o777)
104106

107+
# Making `conservative_temp_folder` writeable again so it could be
108+
# deleted in cleanup:
109+
conservative_temp_folder.chmod(0o777)
105110

106111

0 commit comments

Comments
 (0)