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

Adding creationTime and expirationTime properties to TableListItem #7684

Merged
merged 5 commits into from
Apr 10, 2019

Conversation

lbristol88
Copy link
Contributor

@lbristol88 lbristol88 commented Apr 9, 2019

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 9, 2019
@lbristol88 lbristol88 marked this pull request as ready for review April 9, 2019 20:33
@tswast tswast self-requested a review April 9, 2019 20:37
@tswast tswast added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 9, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 9, 2019
@@ -1138,6 +1147,17 @@ def test_ctor(self):
}

table = self._make_one(resource)

if "creationTime" in resource:
Copy link
Contributor

Choose a reason for hiding this comment

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

creationTime is in resource, as you are setting it above. This if statement is not needed. Just assert on the expected value. Same applies for expirationTime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the If statements for creation an expiration, added asserts on expected value.

import datetime
from google.cloud._helpers import UTC

self.WHEN_TS = 1437767599.006
Copy link
Contributor

Choose a reason for hiding this comment

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

.006 is not accurately representable in base 2, so you may encounter rounding issues with this value. Choose a fraction such as .125 instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made change to .125 as recommended.

1000.0 * float(expiration_time)
)

@expires.setter
Copy link
Contributor

Choose a reason for hiding this comment

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

TableListItem is read-only, so a setter is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the setter.

"""Union[datetime.datetime, None]: Datetime at which the table will be
deleted.

Raises:
Copy link
Contributor

Choose a reason for hiding this comment

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

The Raises section can be removed when the setter is removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the raises comment since setter was removed!

@tswast tswast added the api: bigquery Issues related to the BigQuery API. label Apr 9, 2019
@@ -1174,7 +1170,7 @@ def test_ctor(self):
self.assertEqual(table.time_partitioning.field, "mycolumn")
self.assertEqual(table.labels["some-stuff"], "this-is-a-label")
self.assertIsNone(table.view_use_legacy_sql)
self.assertIsNone(table.expires)
# self.assertIsNone(table.expires)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove, don't comment out.

Actually, could you move this assertIsNone for expires and add one for created to test_ctor_missing_properties?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for removing. Could you add assertions for None values to the test_ctor_missing_properties test, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added assertions for created and expires under the test_ctor_missing_properties test.

@tswast tswast merged commit 14ed4fd into googleapis:master Apr 10, 2019
tswast pushed a commit to tswast/google-cloud-python that referenced this pull request Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants