File: test_file.py

package info (click to toggle)
python-jsonschema-path 0.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 320 kB
  • sloc: python: 950; makefile: 3
file content (23 lines) | stat: -rw-r--r-- 524 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
from pathlib import Path

import pytest

from jsonschema_path.handlers.file import FilePathHandler


class TestFilePathHandler:
    def test_invalid_scheme(self):
        uri = "invalid:///"
        handler = FilePathHandler()

        with pytest.raises(ValueError):
            handler(uri)

    def test_valid(self, create_file):
        test_file = create_file({})
        test_file_uri = Path(test_file).as_uri()
        handler = FilePathHandler()

        result = handler(test_file_uri)

        assert result == {}