diff options
author | Ovv <contact@ovv.dev> | 2020-04-06 11:14:45 +0200 |
---|---|---|
committer | Ingy döt Net <ingy@ingy.net> | 2021-01-13 16:58:40 -0500 |
commit | ddf20330be1fae8813b8ce1789c48f244746d252 (patch) | |
tree | b4014ebc5680a5f201aa0da428e44eb0b1a6b5b9 /tests/lib | |
parent | fc914d52c43f499224f7fb4c2d4c47623adc5b33 (diff) | |
download | pyyaml-git-ddf20330be1fae8813b8ce1789c48f244746d252.tar.gz |
constructor.timezone: __copy_ & __deepcopy__
close #387
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/test_constructor.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/lib/test_constructor.py b/tests/lib/test_constructor.py index 5a8cce2..c76df5e 100644 --- a/tests/lib/test_constructor.py +++ b/tests/lib/test_constructor.py @@ -305,6 +305,18 @@ def test_subclass_blacklist_types(data_filename, verbose=False): test_subclass_blacklist_types.unittest = ['.subclass_blacklist'] +def test_timezone_copy(verbose=False): + import copy + tzinfo = yaml.constructor.timezone(datetime.timedelta(0)) + + tz_copy = copy.copy(tzinfo) + tz_deepcopy = copy.deepcopy(tzinfo) + + if tzinfo.tzname() != tz_copy.tzname() != tz_deepcopy.tzname(): + raise AssertionError("Timezones should be equal") + +test_timezone_copy.unittest = [] + if __name__ == '__main__': import sys, test_constructor sys.modules['test_constructor'] = sys.modules['__main__'] |