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.

28 lines
551 B

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