Skip to content

Conversation

@Bergvca
Copy link
Contributor

@Bergvca Bergvca commented Apr 21, 2018

Summary of changes

Added unittest to check if tz's objects "_filename" attribute is equal to the "name" object of an input fileobject.

Closes
N/a - related to Get coverage to 100% (#521)

Pull Request Checklist

  • Changes have tests
  • Authors have been added to AUTHORS.md
  • News fragment added in changelog.d. See CONTRIBUTING.md for details

@pganssle
Copy link
Member

As a general rule I try not to test the private interface, so I prefer not to test what _filename is set to as that is an implementation detail. It's more important to test the public effects of this than the internal representation.

I think for other tzinfo types this is tested by seeing the effect it has on the repr.

@Bergvca
Copy link
Contributor Author

Bergvca commented Apr 21, 2018

Hi Paul,

Makes sense - I've changed the code to use the repr in the same way it is done in other test functions, for example: testTzwinRepr

AUTHORS.md Outdated
- Brock Mendel <jbrockmendel@MASKED> (gh: @jbrockmendel) **R**
- Brook Li (gh: @absreim) **D**
- Carlos <carlosxl@MASKED>
- Chris van den Berg (gh: bergvca)
Copy link
Member

Choose a reason for hiding this comment

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

All new contributors contribute under the dual license, so the name should have a D after it. I can add this myself.

with self.assertRaises(ValueError):
tz.tzfile(BytesIO(b'BadFile'))

def testFilenameFromAttribute(self):
Copy link
Member

Choose a reason for hiding this comment

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

This is presumably now a repr test, no?

@@ -0,0 +1 @@
Added unittest to check if tz's objects "_filename" attribute is equall to the "name" object of an input fileobject.
Copy link
Member

Choose a reason for hiding this comment

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

This is no longer an accurate description of the changes.

@pganssle pganssle changed the title Added unittest to check if tz's objects "_filename" attribute is equa… Add test for repr of named fileobject in tzfile Apr 22, 2018
@pganssle pganssle force-pushed the add_to_codecoverage branch from 631f847 to 5aabc77 Compare April 22, 2018 15:42
@pganssle
Copy link
Member

@Bergvca Are you aware that your user.email setting is fakeemail@fake.com in git?

Github associates git commits with users based on their e-mail address, so if this is merged as-is, I don't think you'll show up in the Github UI under "Contributors", nor will it show up on your activity summary (at least this was the case last time I looked into it).

If you care about Github UI but want to mask your real e-mail address, you can set your e-mail to Bergvca@users.noreply.github.com. I'm happy to re-write the git history for you before merge so you'll get the credit on github.

@pganssle
Copy link
Member

By the way, I've gone in and cleaned up the history a bit, so make sure to do a force pull before making any further changes.

If you don't care about the github credit, I can merge as-is, otherwise I'll just run:

git fetch upstream master
git rebase --exec 'git commit --amend --no-edit -n --author="Chris van den Berg <Bergvca@users.noreply.github.com>"' -i upstream/master

To rewrite the history with the new e-mail address and merge the results.

@pganssle pganssle added this to the 2.7.3 milestone Apr 23, 2018
@Bergvca
Copy link
Contributor Author

Bergvca commented Apr 24, 2018

Hi Paul,

No I wasn't aware - I've set it to - Bergvca@users.noreply.github.com. You can do the merge as described:

git fetch upstream master
git rebase --exec 'git commit --amend --no-edit -n --author="Chris van den Berg <Bergvca@users.noreply.github.com>"' -i upstream/master

Thanks!

P.s. I've started working on this during the NY Sprint, hope to add some more coverage in the future :)

Bergvca added 3 commits April 24, 2018 10:49
Checks if the tzinfo object's _filename attribute is equal to the
name attribute of the input file object.
The original unit test tested the value of _filename, this instead
tests the publicly observable effect of _filename, the repr of the
object.

Add changelog for this test.
Include dual license acknowledgement
@pganssle pganssle force-pushed the add_to_codecoverage branch from 5aabc77 to 1ed7c7b Compare April 24, 2018 14:49
@pganssle pganssle merged commit be38ff6 into dateutil:master Apr 24, 2018
@pganssle
Copy link
Member

@Bergvca Thanks for your contribution!

@Bergvca Bergvca deleted the add_to_codecoverage branch May 8, 2018 01:06
@pganssle pganssle mentioned this pull request May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants