def test_timestampwithtimezone():
ts = Timestamp(seconds=0, microseconds=0)
tstz = TimestampWithTimezone(timestamp=ts, offset=0, negative_utc=False)
attr.validate(tstz)
assert tstz.negative_utc is False
assert tstz.offset_bytes == b"+0000"
tstz = TimestampWithTimezone(timestamp=ts, offset=10, negative_utc=False)
attr.validate(tstz)
assert tstz.offset_bytes == b"+0010"
tstz = TimestampWithTimezone(timestamp=ts, offset=-10, negative_utc=False)
attr.validate(tstz)
assert tstz.offset_bytes == b"-0010"
tstz = TimestampWithTimezone(timestamp=ts, offset=0, negative_utc=True)
attr.validate(tstz)
assert tstz.negative_utc is True
assert tstz.offset_bytes == b"-0000"
> tstz = TimestampWithTimezone(timestamp=ts, offset=-630, negative_utc=True)
.tox/py3-full/lib/python3.7/site-packages/swh/model/tests/test_model.py:471:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
<attrs generated init swh.model.model.TimestampWithTimezone>:13: in __init__
__attr_validator_negative_utc(self, __attr_negative_utc, self.negative_utc)
.tox/py3-full/lib/python3.7/site-packages/attr/_make.py:3096: in __call__
v(inst, attr, value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = TimestampWithTimezone(timestamp=Timestamp(seconds=0, microseconds=0), offset=-630, negative_utc=True, offset_bytes=b'-1030')
attribute = Attribute(name='negative_utc', default=NOTHING, validator=_AndValidator(_validators=(<function type_validator.<locals>...=True, metadata=mappingproxy({}), type=<class 'bool'>, converter=None, kw_only=False, inherited=False, on_setattr=None)
value = True
@negative_utc.validator
def check_negative_utc(self, attribute, value):
if self.offset and value:
> raise ValueError("negative_utc can only be True is offset=0")
E ValueError: negative_utc can only be True is offset=0
.tox/py3-full/lib/python3.7/site-packages/swh/model/model.py:414: ValueError
TEST RESULT
TEST RESULT
- Run At
- Jan 7 2022, 1:54 PM