-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
bigquery/tests/unit/test_table.py
Outdated
@@ -1138,6 +1147,17 @@ def test_ctor(self): | |||
} | |||
|
|||
table = self._make_one(resource) | |||
|
|||
if "creationTime" in resource: |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
bigquery/tests/unit/test_table.py
Outdated
import datetime | ||
from google.cloud._helpers import UTC | ||
|
||
self.WHEN_TS = 1437767599.006 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
bigquery/tests/unit/test_table.py
Outdated
@@ -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) |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
…oogleapis#7684) * Added properties created and expires to TableListItem
Closes #5117
@tswast @engelke