This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
535 B

  1. from __future__ import absolute_import
  2. from unittest import TestCase
  3. import logging
  4. import copy
  5. import pickle
  6. from lark.tree import Tree
  7. class TestTrees(TestCase):
  8. def setUp(self):
  9. self.tree1 = Tree('a', [Tree(x, y) for x, y in zip('bcd', 'xyz')])
  10. def test_deepcopy(self):
  11. assert self.tree1 == copy.deepcopy(self.tree1)
  12. def test_pickle(self):
  13. s = copy.deepcopy(self.tree1)
  14. data = pickle.dumps(s)
  15. assert pickle.loads(data) == s
  16. if __name__ == '__main__':
  17. unittest.main()