File: test_formats.py

package info (click to toggle)
python-canmatrix 1.2~github-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,012 kB
  • sloc: xml: 30,201; python: 14,631; makefile: 31; sh: 7
file content (26 lines) | stat: -rw-r--r-- 460 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
# -*- coding: utf-8 -*-
import io
import textwrap

import canmatrix.formats


def test_dump_matrix():
    matrix = canmatrix.CanMatrix()

    codec = 'utf-8'

    f = io.BytesIO()
    canmatrix.formats.dump(matrix, f, 'sym', symExportEncoding=codec)

    result = f.getvalue()

    expected = textwrap.dedent(u'''\
    FormatVersion=5.0 // Do not edit this line!
    Title="canmatrix-Export"
    {ENUMS}


    ''').encode(codec)

    assert result == expected