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

Return empty dictionary when file has no properties #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

idbrii
Copy link

@idbrii idbrii commented Apr 29, 2021

Fix #89: properties method failed when no props defined

When a file has no properties, the xml doesn't contain 'target' and
target_elem is None. To conform to the documentation for properties,
return an empty dict (instead of None).

Test for both no properties and mime type property (writing a binary
file in the simplest way I can find).

Ran tests with nose2 on WSL and all passed.

@coveralls
Copy link

coveralls commented Apr 29, 2021

Coverage Status

Coverage increased (+3.0%) to 81.044% when pulling 9f01114 on idbrii:fix-89-properties into c0878be on dsoprea:master.

@idbrii
Copy link
Author

idbrii commented Apr 29, 2021

This has some overlap with #121, but it's a smaller fix without merge conflicts.

Fix dsoprea#89: properties method failed when no props defined

When a file has no properties, the xml doesn't contain 'target' and
target_elem is None. To conform to the documentation for properties,
return an empty dict (instead of None).

Test for both no properties and mime type property (writing a binary
file in the simplest way I can find that works in py2 and py3).
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.

properties method failed when no props defined
2 participants