File: test_pickle.py

package info (click to toggle)
python-rtree 0.8.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 376 kB
  • sloc: python: 1,611; makefile: 105; sh: 1
file content (20 lines) | stat: -rw-r--r-- 670 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pickle
import unittest
import rtree.index


class TestPickling(unittest.TestCase):

    def test_index(self):
        idx = rtree.index.Index()
        unpickled = pickle.loads(pickle.dumps(idx))
        self.assertNotEquals(idx.handle, unpickled.handle)
        self.assertEquals(idx.properties.as_dict(),
                          unpickled.properties.as_dict())
        self.assertEquals(idx.interleaved, unpickled.interleaved)

    def test_property(self):
        p = rtree.index.Property()
        unpickled = pickle.loads(pickle.dumps(p))
        self.assertNotEquals(p.handle, unpickled.handle)
        self.assertEquals(p.as_dict(), unpickled.as_dict())