Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove repetitive/redundant code #88

Closed
wants to merge 1 commit into from
Closed

Remove repetitive/redundant code #88

wants to merge 1 commit into from

Conversation

eumiro
Copy link
Contributor

@eumiro eumiro commented Nov 25, 2020

No description provided.

@codecov
Copy link

codecov bot commented Nov 25, 2020

Codecov Report

Merging #88 (5bbab8e) into master (f81554d) will decrease coverage by 0.01%.
The diff coverage is 69.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #88      +/-   ##
==========================================
- Coverage   95.09%   95.07%   -0.02%     
==========================================
  Files           7        7              
  Lines        1284     1280       -4     
  Branches      115      115              
==========================================
- Hits         1221     1217       -4     
  Misses         43       43              
  Partials       20       20              
Impacted Files Coverage Δ
tnefparse/util.py 90.47% <0.00%> (ø)
tnefparse/tnef.py 92.70% <62.50%> (-0.13%) ⬇️
tnefparse/mapi.py 81.09% <100.00%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f81554d...5bbab8e. Read the comment docs.

@@ -68,7 +68,7 @@ def test_dump(script_runner):
ret = script_runner.run('tnefparse', '-d', 'tests/examples/two-files.tnef')
assert ret.success
dump = json.loads(ret.stdout)
assert sorted(list(dump.keys())) == ['attachments', 'attributes', 'extended_attributes']
assert sorted(dump) == ['attachments', 'attributes', 'extended_attributes']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I learned something new.

Following the Zen of Python, I'd still personally prefer:

assert sorted(dump.keys())

even when it is not necessary.

L = len(tozip.get(filename, []))
if L > 0:
if tozip.get(filename):
length = len(tozip.get(filename))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no coverage for this line. It would be great to have a test for it.

@@ -45,7 +45,7 @@ def systime(byte_arr, offset=0):
return datetime.utcfromtimestamp((ft - EPOCH_AS_FILETIME) / HUNDREDS_OF_NANOSECONDS)
except: # noqa: E722
microseconds = ft / 10
return (datetime(1601, 1, 1) + timedelta(microseconds=microseconds))
return datetime(1601, 1, 1) + timedelta(microseconds=microseconds)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no coverage for this line. It would be great to have a test for it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be non-trivial to come up with a test case #92 (comment)

@jrideout
Copy link
Collaborator

Rebased changes were merged in #103

@jrideout jrideout closed this Jan 21, 2021
@eumiro eumiro deleted the refactor branch January 21, 2021 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants