/usr/lib/python3/dist-packages/openpyxl/styles/tests/test_number_style.py is in python3-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 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
from openpyxl.styles import numbers
def test_builtin_format():
fmt = '0.00'
assert numbers.builtin_format_code(2) == fmt
def test_number_descriptor():
from openpyxl.descriptors import Strict
from ..numbers import NumberFormatDescriptor
class Dummy(Strict):
value = NumberFormatDescriptor()
def __init__(self, value=None):
self.value = value
dummy = Dummy()
assert dummy.value == "General"
@pytest.mark.parametrize("format, result",
[
("DD/MM/YY", True),
("H:MM:SS;@", True),
(u'#,##0\\ [$\u20bd-46D]', False)
]
)
def test_is_date_format(format, result):
from ..numbers import is_date_format
assert is_date_format(format) is result
@pytest.mark.parametrize("fmt, result",
[
("[h]:mm:ss", True),
("[hh]:mm:ss", True),
(u'#,##0\\ [$\u20bd-46D]', True),
('"$"#,##0_);[Red]("$"#,##0)', True)
]
)
def test_datetime_regex(fmt, result):
from ..numbers import BAD_DATE_RE
match = BAD_DATE_RE.search(fmt.lower()) is not None
assert match is result
|