File: test_inspect.py

package info (click to toggle)
python-xlrd 2.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,832 kB
  • sloc: python: 7,531; makefile: 118; sh: 7
file content (32 lines) | stat: -rw-r--r-- 702 bytes parent folder | download
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
from xlrd import inspect_format

from .helpers import from_sample


def test_xlsx():
    assert inspect_format(from_sample('sample.xlsx')) == 'xlsx'


def test_xlsb():
    assert inspect_format(from_sample('sample.xlsb')) == 'xlsb'


def test_ods():
    assert inspect_format(from_sample('sample.ods')) == 'ods'


def test_zip():
    assert inspect_format(from_sample('sample.zip')) == 'zip'


def test_xls():
    assert inspect_format(from_sample('namesdemo.xls')) == 'xls'


def test_content():
    with open(from_sample('sample.xlsx'), 'rb') as source:
        assert inspect_format(content=source.read()) == 'xlsx'


def test_unknown():
    assert inspect_format(from_sample('sample.txt')) is None