<commit_before># Copyright (c) 2020, <NAME>
# License: MIT License
import pytest
from ezdxf.lldxf.tags import Tags
from ezdxf.lldxf.tagwriter import TagCollector
from ezdxf.proxygraphic import load_proxy_graphic, export_proxy_graphic, ProxyGraphic


def test_load_proxy_graphic():
    binary_data = load_proxy_graphic(Tags.from_text(DATA))
    assert len(binary_data) == 968


def test_export_proxy_graphic():
    tagwriter = TagCollector()
    binary_data = load_proxy_graphic(Tags.from_text(DATA))
    export_proxy_graphic(binary_data, tagwriter)
    s = ''.join(tag.dxfstr() for tag in tagwriter.tags)
    assert s == DATA


class TestProxyGraphic:
    @pytest.fixture(scope='class')
    def data(self) -> bytes:
        return load_proxy_graphic(Tags.from_text(DATA))

    @pytest.fixture
    def parser(self, data: bytes) -> ProxyGraphic:
        return ProxyGraphic(data)

    def test_info(self, parser: ProxyGraphic):
        indices = list(parser.info())
        assert len(indices) == 13
        index, size, type_ = indices[0]
        assert (index, size, type_) == (8, 84, 'POLYLINE_WITH_NORMALS')

    def test_multi_leader_entities(self):
        # ATTRIBUTE_TRUE_COLOR; size: 12
        # UNKNOWN_TYPE_51; size: 12
        # ATTRIBUTE_MARKER; size: 12<commit_msg>ProxyGraphic() does not work on Linux, skipping tests for now<commit_after># Copyright (c) 2020, <NAME>
# License: MIT License
import sys
import pytest
from ezdxf.lldxf.tags import Tags
from ezdxf.lldxf.tagwriter import TagCollector
from ezdxf.proxygraphic import load_proxy_graphic, export_proxy_graphic, ProxyGraphic

WIN = sys.platform.startswith('win')


def test_load_proxy_graphic():
    binary_data = load_proxy_graphic(Tags.from_text(DATA))
    assert len(binary_data) == 968


def test_export_proxy_graphic():
    tagwriter = TagCollector()
    binary_data = load_proxy_graphic(Tags.from_text(DATA))
    export_proxy_graphic(binary_data, tagwriter)
    s = ''.join(tag.dxfstr() for tag in tagwriter.tags)
    assert s == DATA


@pytest.mark.skipif(WIN is not True, reason='works only on Windows yet!')
class TestProxyGraphic:
    @pytest.fixture(scope='class')
    def data(self) -> bytes:
        return load_proxy_graphic(Tags.from_text(DATA))

    @pytest.fixture
    def parser(self, data: bytes) -> ProxyGraphic:
        return ProxyGraphic(data)

    def test_info(self, parser: ProxyGraphic):
        indices = list(parser.info())
        assert len(indices) == 13
        index, size, type_ = indices[0]
        assert (index, size, type_) == (8, 84, 'POLYLINE_WITH_NORMALS')

    def test_multi_leader_entities(self):
        # ATTRIBUTE_TRUE_COLOR; size: 12
        # UNKNOWN_TYPE_51; size: 12
        # ATTRIBUTE_MARKER; size: 12
{'fraction_non_alphanumeric': 0.1034103410341034, 'fraction_numerical': 0.015401540154015401, 'mean_word_length': 3.987202925045704, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2008767', 'n_tokens_mistral': 966, 'n_tokens_neox': 929, 'n_words': 211}