Adding creationTime and expirationTime properties to TableListItem#7684
Adding creationTime and expirationTime properties to TableListItem#7684tswast merged 5 commits intogoogleapis:masterfrom
Conversation
bigquery/tests/unit/test_table.py
Outdated
|
|
||
| table = self._make_one(resource) | ||
|
|
||
| if "creationTime" in resource: |
There was a problem hiding this comment.
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.
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.
.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.
Made change to .125 as recommended.
| 1000.0 * float(expiration_time) | ||
| ) | ||
|
|
||
| @expires.setter |
There was a problem hiding this comment.
TableListItem is read-only, so a setter is not needed.
There was a problem hiding this comment.
Removed the setter.
| """Union[datetime.datetime, None]: Datetime at which the table will be | ||
| deleted. | ||
|
|
||
| Raises: |
There was a problem hiding this comment.
The Raises section can be removed when the setter is removed.
There was a problem hiding this comment.
Removed the raises comment since setter was removed!
bigquery/tests/unit/test_table.py
Outdated
| 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.
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.
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.
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