Skip to content

Commit

Permalink
Add doctest for infer_compression. Increases coverage from 77% to 80%.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jan 19, 2023
1 parent 2706e47 commit 80f4d01
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jaraco/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ def tarball_context(url, target_dir=None, runner=None, pushd=pushd):
def infer_compression(url):
"""
Given a URL or filename, infer the compression code for tar.
>>> infer_compression('http://foo/bar.tar.gz')
'z'
>>> infer_compression('http://foo/bar.tgz')
'z'
>>> infer_compression('file.bz')
'j'
>>> infer_compression('file.xz')
'J'
"""
# cheat and just assume it's the last two characters
compression_indicator = url[-2:]
Expand Down

0 comments on commit 80f4d01

Please sign in to comment.