-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
test_issue_0144.py
25 lines (19 loc) · 867 Bytes
/
test_issue_0144.py
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
import pathlib
import unittest
from benedict import benedict
class github_issue_0144_test_case(unittest.TestCase):
"""
This class describes a github issue 0144 test case.
https://github.com/fabiocaccamo/python-benedict/issues/144
To run this specific test:
- Run python -m unittest tests.github.test_issue_0144
"""
def test_init_with_pathlib_path_object_and_valid_path(self):
# print(pathlib.Path("./test_issue_0144.json"))
d = benedict(pathlib.Path("tests/github/test_issue_0144.json"), format="json")
self.assertEqual(d, {"a": 1, "b": 2, "c": 3, "x": 7, "y": 8, "z": 9})
def test_init_with_pathlib_path_object_and_invalid_path(self):
with self.assertRaises(ValueError):
benedict(
pathlib.Path("tests/github/test_issue_0144_invalid.json"), format="json"
)