File: extensions_test.py

package info (click to toggle)
identify 2.6.15-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 488 kB
  • sloc: python: 6,533; makefile: 10
file content (30 lines) | stat: -rw-r--r-- 897 bytes parent folder | download | duplicates (3)
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
from __future__ import annotations

import pytest

from identify import extensions


@pytest.mark.parametrize('extension', extensions.EXTENSIONS)
def test_extensions_have_binary_or_text(extension):
    tags = extensions.EXTENSIONS[extension]
    assert len({'text', 'binary'} & tags) == 1, tags


@pytest.mark.parametrize('name', extensions.NAMES)
def test_names_have_binary_or_text(name):
    tags = extensions.NAMES[name]
    assert len({'text', 'binary'} & tags) == 1, tags


@pytest.mark.parametrize('extension', extensions.EXTENSIONS_NEED_BINARY_CHECK)
def test_need_binary_check_do_not_specify_text_binary(extension):
    tags = extensions.EXTENSIONS_NEED_BINARY_CHECK[extension]
    assert len({'text', 'binary'} & tags) == 0, tags


def test_mutually_exclusive_check_types():
    assert not (
        set(extensions.EXTENSIONS) &
        set(extensions.EXTENSIONS_NEED_BINARY_CHECK)
    )