/usr/lib/python2.7/dist-packages/openpyxl/styles/tests/test_hashable.py is in python-openpyxl 2.3.0-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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | from openpyxl.styles import HashableObject
import pytest
@pytest.fixture
def Immutable():
class Immutable(HashableObject):
__fields__ = ('value',)
def __init__(self, value=None):
self.value = value
return Immutable
class TestHashable:
def test_ctor(self, Immutable):
d = Immutable()
d.value = 1
assert d.value == 1
def test_copy(self, Immutable):
d = Immutable()
d.value = 1
c = d.copy()
assert c == d
def test_hash(self, Immutable):
d1 = Immutable()
d2 = Immutable()
assert hash(d1) == hash(d2)
def test_str(self, Immutable):
d = Immutable()
assert str(d) == "Immutable(value=None)"
d2 = Immutable("hello")
assert str(d2) == "Immutable(value='hello')"
def test_repr(self, Immutable):
d = Immutable()
assert repr(d) == ""
d2 = Immutable("hello")
assert repr(d2) == "Immutable(value='hello')"
class ImmutableBase(Immutable):
__base__ = True
d = ImmutableBase()
assert repr(d) == "ImmutableBase()"
def test_eq(self, Immutable):
d1 = Immutable(1)
d2 = Immutable(1)
assert d1 is not d2
assert d1 == d2
def test_ne(self, Immutable):
d1 = Immutable(1)
d2 = Immutable(2)
assert d1 != d2
|