This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年08月23日 08:31 by hynek, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| write_file_returns_filename.diff | hynek, 2011年08月23日 08:31 | Make write_file return file name and simplify some tests. | review | |
| Messages (3) | |||
|---|---|---|---|
| msg142795 - (view) | Author: Hynek Schlawack (hynek) * (Python committer) | Date: 2011年08月23日 08:31 | |
test_shutil contains a handy helper function called write_file(filename. contents). If *filename* is a tuple, os.path.join() is used to concatenate it to a path. To be really useful, the resulting file name should be returned, so the user can work with it. So instead of: fn = os.path.join(x,y) write_file(fn, 'contents') I'd prefer: fn = write_file((x,y), 'contents') I have attached a simple patch that achieves this and also applied the resulting simplification to some of the tests. |
|||
| msg142802 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年08月23日 09:00 | |
Hm, I don’t think the patch makes the test easier to read or maintain. As I wrote in the commit message for #12721: > For simple open then read/write calls, I have left the usual idiom > (with open + read/write), as it is short and readable enough. In the current tests, sometimes os.path.join is called and the resulting name (e.g. src) is used to write contents and then as argument to a shutil function; I actually prefer that src paths are created right before dst and with similar code. So I think I’ll reject this patch. |
|||
| msg142888 - (view) | Author: Hynek Schlawack (hynek) * (Python committer) | Date: 2011年08月24日 17:00 | |
ok. it would have saved some LOC for me, but it's nothing essential of course. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:21 | admin | set | github: 57033 |
| 2011年08月24日 17:00:39 | hynek | set | status: open -> closed resolution: rejected messages: + msg142888 |
| 2011年08月23日 09:00:50 | eric.araujo | set | messages: + msg142802 |
| 2011年08月23日 08:31:35 | hynek | create | |