/usr/share/pyshared/quantities/tests/test_persistence.py is in python-quantities 0.10.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # -*- coding: utf-8 -*-
import pickle
from .. import units as pq
from ..uncertainquantity import UncertainQuantity
from .. import constants
from .common import TestCase
class TestPersistence(TestCase):
def test_unitquantity_persistance(self):
x = pq.m
y = pickle.loads(pickle.dumps(x))
self.assertQuantityEqual(x, y)
x = pq.CompoundUnit("pc/cm**3")
y = pickle.loads(pickle.dumps(x))
self.assertQuantityEqual(x, y)
def test_quantity_persistance(self):
x = 20*pq.m
y = pickle.loads(pickle.dumps(x))
self.assertQuantityEqual(x, y)
def test_uncertainquantity_persistance(self):
x = UncertainQuantity(20, 'm', 0.2)
y = pickle.loads(pickle.dumps(x))
self.assertQuantityEqual(x, y)
def test_unitconstant_persistance(self):
x = constants.m_e
y = pickle.loads(pickle.dumps(x))
self.assertQuantityEqual(x, y)
|