Add flush progress detection to BufferedWriter

Prior to this patch, PIPE_BUF_BYTES smaller than 65535[0] would cause
infinite loops.  It so happens that that this constant and the floor
of PIPE_BUF_BYTES being 65535 as defined by
pipebuf._configure_buffer_sizes obscures this problem, but it is too
frail to rely on.

Instead, discontinue attempts to flush if the inner loop makes no
attempts to write out any bytes, as so PIPE_BUF_BYTES can be decoupled
from the flush retention size.

[0]: The constant of how much data should remain in the buffer at a
     maximum after flushing
Use a more idiomatic docstring for test documentation

Moves things around a bit is all.
Move "from ... import ..." below "import ..."

Per convention seen elsewhere.  No functional changes.
Create containing directories when extracting a file

This would cause extractions relying on the new async-io-like
optimizations[0] to fail if the parent directory was not already
created.

[0]: 241fcdf0bd16de9ebbb0f5c57dcb6e5f109480ee
Add test exposing upper-directory creation crash with cat extract

Done as a separate patch from the fix so the bug can be confirmed on
old versions.