File: test_config_mapper.py

package info (click to toggle)
fdb 5.20.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 89,268 kB
  • sloc: cpp: 40,830; python: 5,079; sh: 4,996; makefile: 32; ansic: 8
file content (23 lines) | stat: -rw-r--r-- 725 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
import pytest
import yaml

from pyfdb._internal.pyfdb_internal import ConfigMapper


def test_config_mapper_wrong_type():
    with pytest.raises(ValueError):
        _ = ConfigMapper.to_json(0)


def test_config_mapper_none():
    json_config = ConfigMapper.to_json(None)
    assert json_config is None


def test_config_mapper_equality(read_only_fdb_setup):
    json_config_from_path = ConfigMapper.to_json(read_only_fdb_setup)
    json_config_from_str = ConfigMapper.to_json(read_only_fdb_setup.read_text())
    json_config_from_yaml = ConfigMapper.to_json(yaml.safe_load(read_only_fdb_setup.read_bytes()))

    assert json_config_from_path == json_config_from_str
    assert json_config_from_path == json_config_from_yaml