library.py: Add helper methods.
library.py: Optimise imports.
test_delete.py: Use new helpers.
test_{delete,chgrp}.py: Add tests.

This commit implements tests from tickets #12452 and #12544.
test_chgrp.py: Optimise imports.
Add docstrings and verify parameter types.
Verify and update comments.
Update delete test assertions and comment.
Merge pull request #3163 from bpindelski/12452-tests

Add chgrp/delete Python tests (assist #12452 and #12544).