File: test_054_dxfattr.py

package info (click to toggle)
ezdxf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104,528 kB
  • sloc: python: 182,341; makefile: 116; lisp: 20; ansic: 4
file content (27 lines) | stat: -rw-r--r-- 541 bytes parent folder | download | duplicates (2)
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
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License

import pytest
from ezdxf.lldxf.attributes import DXFAttr, RETURN_DEFAULT


def test_return_default():
    attr = DXFAttr(
        code=62,
        default=12,
        validator=lambda x: False,
        fixer=RETURN_DEFAULT,
    )
    assert attr.fixer(7) == 12

    attr2 = DXFAttr(
        code=63,
        default=13,
        validator=lambda x: False,
        fixer=RETURN_DEFAULT,
    )
    assert attr2.fixer(7) == 13


if __name__ == "__main__":
    pytest.main([__file__])