mooch.settings 0.0.1.dev1__tar.gz → 0.0.1.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. mooch_settings-0.0.1.dev3/.github/workflows/run_tests.yml +51 -0
  2. {mooch_settings-0.0.1.dev1/src/mooch.settings.egg-info → mooch_settings-0.0.1.dev3}/PKG-INFO +6 -2
  3. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/README.md +5 -1
  4. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/pyproject.toml +1 -1
  5. mooch_settings-0.0.1.dev3/src/mooch/settings/__init__.py +3 -0
  6. mooch_settings-0.0.1.dev1/src/mooch/settings/file.py → mooch_settings-0.0.1.dev3/src/mooch/settings/filehandler.py +12 -10
  7. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/src/mooch/settings/settings.py +16 -11
  8. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3/src/mooch.settings.egg-info}/PKG-INFO +6 -2
  9. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/src/mooch.settings.egg-info/SOURCES.txt +2 -1
  10. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/tests/test_file.py +6 -6
  11. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/tests/test_settings.py +61 -24
  12. mooch_settings-0.0.1.dev1/src/mooch/settings/__init__.py +0 -4
  13. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/.gitignore +0 -0
  14. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/LICENSE +0 -0
  15. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/settings.toml +0 -0
  16. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/setup.cfg +0 -0
  17. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/src/mooch/__init__.py +0 -0
  18. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/src/mooch/settings/utils.py +0 -0
  19. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/src/mooch.settings.egg-info/dependency_links.txt +0 -0
  20. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/src/mooch.settings.egg-info/requires.txt +0 -0
  21. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/src/mooch.settings.egg-info/top_level.txt +0 -0
  22. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/tests/test_utils.py +0 -0
  23. {mooch_settings-0.0.1.dev1 → mooch_settings-0.0.1.dev3}/uv.lock +0 -0
@@ -0,0 +1,51 @@
1
+ name: Run Tests and Upload Coverage
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16
+ env:
17
+ OS: ${{ matrix.os }}
18
+ PYTHON: ${{ matrix.python-version }}
19
+
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Set up Python ${{ matrix.python-version }}
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: ${{ matrix.python-version }}
28
+
29
+ - name: Install the latest version of uv
30
+ uses: astral-sh/setup-uv@v6
31
+
32
+
33
+ - name: Install dependencies
34
+ run: uv pip install --system . pytest pytest-cov
35
+
36
+ - name: Run tests with coverage
37
+ run: |
38
+ pytest --cov=./ --cov-report=xml
39
+
40
+ - name: Upload coverage to Codecov
41
+ uses: codecov/codecov-action@v5
42
+ with:
43
+ directory: ./coverage/reports/
44
+ env_vars: OS,PYTHON
45
+ fail_ci_if_error: true
46
+ files: ./coverage.xml,!./cache
47
+ flags: unittests
48
+ name: codecov-umbrella
49
+ token: ${{ secrets.CODECOV_TOKEN }}
50
+ verbose: true
51
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mooch.settings
3
- Version: 0.0.1.dev1
3
+ Version: 0.0.1.dev3
4
4
  Summary: Python settings management package (mooch.settings). Uses a TOML file.
5
5
  Author-email: Nick Stuer <nickstuer@duck.com>
6
6
  Project-URL: Homepage, https://github.com/nickstuer/mooch.settings
@@ -21,6 +21,10 @@ Dynamic: license-file
21
21
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/mooch.settings)
22
22
  <img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues/nickstuer/mooch.settings">
23
23
 
24
+ ![Python Versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12|%203.13-blue?logo=python)
25
+ ![Codecov](https://img.shields.io/codecov/c/github/nickstuer/mooch.settings)
26
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/nickstuer/mooch.settings/run_tests.yml)
27
+
24
28
  [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
25
29
  [![license](https://img.shields.io/github/license/nickstuer/mooch.settings.svg)](LICENSE)
26
30
 
@@ -38,7 +42,7 @@ This Python package is a collection of useful Python code that is commonly used
38
42
 
39
43
 
40
44
  ### Settings File
41
- Uses a TOML settings file. Easily get/set settingsuration values. Automatically sets values to defaults if they're not currently saved in the settingsuration file.
45
+ Uses a TOML settings file. Easily get/set settings values. Automatically sets values to defaults if they're not currently saved in the setting file.
42
46
 
43
47
 
44
48
  ## 🛠 Install
@@ -4,6 +4,10 @@
4
4
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/mooch.settings)
5
5
  <img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues/nickstuer/mooch.settings">
6
6
 
7
+ ![Python Versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12|%203.13-blue?logo=python)
8
+ ![Codecov](https://img.shields.io/codecov/c/github/nickstuer/mooch.settings)
9
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/nickstuer/mooch.settings/run_tests.yml)
10
+
7
11
  [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
8
12
  [![license](https://img.shields.io/github/license/nickstuer/mooch.settings.svg)](LICENSE)
9
13
 
@@ -21,7 +25,7 @@ This Python package is a collection of useful Python code that is commonly used
21
25
 
22
26
 
23
27
  ### Settings File
24
- Uses a TOML settings file. Easily get/set settingsuration values. Automatically sets values to defaults if they're not currently saved in the settingsuration file.
28
+ Uses a TOML settings file. Easily get/set settings values. Automatically sets values to defaults if they're not currently saved in the setting file.
25
29
 
26
30
 
27
31
  ## 🛠 Install
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mooch.settings"
3
- version = "0.0.1dev1"
3
+ version = "0.0.1dev3"
4
4
  authors = [
5
5
  { name="Nick Stuer", email="nickstuer@duck.com" },
6
6
  ]
@@ -0,0 +1,3 @@
1
+ from mooch.settings.settings import Settings # noqa: D104
2
+
3
+ __all__ = ["Settings"]
@@ -14,20 +14,22 @@ CREATED_KEY = "metadata.created"
14
14
  UPDATED_KEY = "metadata.updated"
15
15
 
16
16
 
17
- class File:
17
+ class FileHandler:
18
18
  def __init__(self, settings_filepath: Path) -> None:
19
19
  self._filepath = settings_filepath
20
- self.create_file_if_not_exists()
21
-
22
- def create_file_if_not_exists(self) -> None:
23
- """Create the settings file if it does not exist."""
24
20
  if not self._filepath.exists():
25
- data = {}
26
- set_nested(data, NOTICE_KEY, NOTICE)
27
- set_nested(data, CREATED_KEY, datetime.now(tz=timezone.utc).isoformat())
28
- set_nested(data, UPDATED_KEY, datetime.now(tz=timezone.utc).isoformat())
21
+ self.create_file_and_directories()
22
+
23
+ def create_file_and_directories(self) -> None:
24
+ """Create the settings file and directories."""
25
+ # Ensure the parent directory exists
26
+ self._filepath.parent.mkdir(parents=True, exist_ok=True)
27
+ data = {}
28
+ set_nested(data, NOTICE_KEY, NOTICE)
29
+ set_nested(data, CREATED_KEY, datetime.now(tz=timezone.utc).isoformat())
30
+ set_nested(data, UPDATED_KEY, datetime.now(tz=timezone.utc).isoformat())
29
31
 
30
- self.save(data)
32
+ self.save(data)
31
33
 
32
34
  def load(self) -> dict[str, Any]:
33
35
  """Load the settings from the file."""
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  from pathlib import Path
4
4
  from typing import Any
5
5
 
6
- from mooch.settings.file import File
6
+ from mooch.settings.filehandler import FileHandler
7
7
  from mooch.settings.utils import get_nested, set_nested
8
8
 
9
9
 
@@ -12,9 +12,19 @@ class Settings:
12
12
  self,
13
13
  settings_filepath: Path,
14
14
  default_settings: dict | None = None,
15
+ *,
16
+ dynamic_reload: bool = True,
15
17
  ) -> None:
16
- self._file = File(settings_filepath)
17
- self.dynamic_reload = True
18
+ if not isinstance(settings_filepath, Path):
19
+ error_message = "settings_filepath must be a Path object"
20
+ raise TypeError(error_message)
21
+ if not isinstance(default_settings, dict) and default_settings is not None:
22
+ error_message = "default_settings must be a dictionary or None"
23
+ raise TypeError(error_message)
24
+
25
+ self._settings_filepath = settings_filepath
26
+ self._file = FileHandler(self._settings_filepath)
27
+ self.dynamic_reload = dynamic_reload
18
28
 
19
29
  self._data = self._file.load()
20
30
 
@@ -22,14 +32,6 @@ class Settings:
22
32
  self._set_defaults(default_settings)
23
33
  self._file.save(self._data)
24
34
 
25
- @staticmethod
26
- def home_directory() -> Path:
27
- """Return the path to the home directory.
28
-
29
- Returns: Path
30
- """
31
- return Path.home()
32
-
33
35
  def get(self, key: str) -> Any | None: # noqa: ANN401
34
36
  """Return a value from the configuration by key.
35
37
 
@@ -74,3 +76,6 @@ class Settings:
74
76
 
75
77
  elif isinstance(v, dict):
76
78
  self._set_defaults(v, full_key)
79
+
80
+ def __repr__(self) -> str: # noqa: D105
81
+ return f"Settings Stored at: {self._settings_filepath}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mooch.settings
3
- Version: 0.0.1.dev1
3
+ Version: 0.0.1.dev3
4
4
  Summary: Python settings management package (mooch.settings). Uses a TOML file.
5
5
  Author-email: Nick Stuer <nickstuer@duck.com>
6
6
  Project-URL: Homepage, https://github.com/nickstuer/mooch.settings
@@ -21,6 +21,10 @@ Dynamic: license-file
21
21
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/mooch.settings)
22
22
  <img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues/nickstuer/mooch.settings">
23
23
 
24
+ ![Python Versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12|%203.13-blue?logo=python)
25
+ ![Codecov](https://img.shields.io/codecov/c/github/nickstuer/mooch.settings)
26
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/nickstuer/mooch.settings/run_tests.yml)
27
+
24
28
  [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
25
29
  [![license](https://img.shields.io/github/license/nickstuer/mooch.settings.svg)](LICENSE)
26
30
 
@@ -38,7 +42,7 @@ This Python package is a collection of useful Python code that is commonly used
38
42
 
39
43
 
40
44
  ### Settings File
41
- Uses a TOML settings file. Easily get/set settingsuration values. Automatically sets values to defaults if they're not currently saved in the settingsuration file.
45
+ Uses a TOML settings file. Easily get/set settings values. Automatically sets values to defaults if they're not currently saved in the setting file.
42
46
 
43
47
 
44
48
  ## 🛠 Install
@@ -4,6 +4,7 @@ README.md
4
4
  pyproject.toml
5
5
  settings.toml
6
6
  uv.lock
7
+ .github/workflows/run_tests.yml
7
8
  src/mooch/__init__.py
8
9
  src/mooch.settings.egg-info/PKG-INFO
9
10
  src/mooch.settings.egg-info/SOURCES.txt
@@ -11,7 +12,7 @@ src/mooch.settings.egg-info/dependency_links.txt
11
12
  src/mooch.settings.egg-info/requires.txt
12
13
  src/mooch.settings.egg-info/top_level.txt
13
14
  src/mooch/settings/__init__.py
14
- src/mooch/settings/file.py
15
+ src/mooch/settings/filehandler.py
15
16
  src/mooch/settings/settings.py
16
17
  src/mooch/settings/utils.py
17
18
  tests/test_file.py
@@ -4,7 +4,7 @@ from pathlib import Path
4
4
  import pytest
5
5
  import toml
6
6
 
7
- from mooch.settings.file import CREATED_KEY, NOTICE, UPDATED_KEY, File
7
+ from mooch.settings.filehandler import CREATED_KEY, NOTICE, UPDATED_KEY, FileHandler
8
8
 
9
9
 
10
10
  @pytest.fixture
@@ -17,7 +17,7 @@ def temp_settings_file(tmp_path):
17
17
 
18
18
 
19
19
  def test_create_file_if_not_exists_creates_file_with_metadata(temp_settings_file):
20
- file = File(temp_settings_file)
20
+ file = FileHandler(temp_settings_file)
21
21
  assert temp_settings_file.exists()
22
22
  data = toml.load(temp_settings_file)
23
23
  assert data["metadata"]["notice"] == NOTICE
@@ -26,7 +26,7 @@ def test_create_file_if_not_exists_creates_file_with_metadata(temp_settings_file
26
26
 
27
27
 
28
28
  def test_load_returns_correct_data(temp_settings_file):
29
- file = File(temp_settings_file)
29
+ file = FileHandler(temp_settings_file)
30
30
  # Write some data
31
31
  data = {"foo": {"bar": 123}}
32
32
  file.save(data)
@@ -36,7 +36,7 @@ def test_load_returns_correct_data(temp_settings_file):
36
36
 
37
37
 
38
38
  def test_save_updates_updated_timestamp(temp_settings_file):
39
- file = File(temp_settings_file)
39
+ file = FileHandler(temp_settings_file)
40
40
  data = file.load()
41
41
  old_updated = data["metadata"]["updated"]
42
42
  # Wait a moment to ensure timestamp changes
@@ -49,7 +49,7 @@ def test_save_updates_updated_timestamp(temp_settings_file):
49
49
 
50
50
 
51
51
  def test_save_and_load_roundtrip(temp_settings_file):
52
- file = File(temp_settings_file)
52
+ file = FileHandler(temp_settings_file)
53
53
  data = {"alpha": 1, "beta": {"gamma": 2}}
54
54
  file.save(data)
55
55
  loaded = file.load()
@@ -62,7 +62,7 @@ def test_create_file_if_not_exists_does_not_overwrite_existing(temp_settings_fil
62
62
  # Create file manually
63
63
  with Path.open(temp_settings_file, "w", encoding="utf-8") as f:
64
64
  f.write('[custom]\nkey="value"\n')
65
- file = File(temp_settings_file)
65
+ file = FileHandler(temp_settings_file)
66
66
  data = file.load()
67
67
  assert "custom" in data
68
68
  assert data["custom"]["key"] == "value"
@@ -22,8 +22,8 @@ default_settings2 = {
22
22
  @pytest.fixture
23
23
  def settings_filepath(tmpdir_factory: pytest.TempdirFactory):
24
24
  temp_dir = str(tmpdir_factory.mktemp("temp"))
25
- filepath = temp_dir + "/settings.toml"
26
- yield Path(filepath)
25
+ temp_testing_dir = temp_dir + "/testing/settings.toml"
26
+ yield Path(temp_testing_dir)
27
27
  # yield Path("settings.toml")
28
28
  shutil.rmtree(temp_dir)
29
29
 
@@ -45,7 +45,37 @@ def test_settings_initializes_with_default_settings(settings_filepath: Path):
45
45
  assert settings.get("foo") is None
46
46
 
47
47
 
48
- def test_settings_sets_default_settings_if_not_present(settings_filepath: str):
48
+ @pytest.mark.parametrize(
49
+ ("value"),
50
+ [
51
+ ("settings.toml"),
52
+ (523),
53
+ (None),
54
+ (["settings.toml"]),
55
+ ({"settings.toml": "value"}),
56
+ ],
57
+ )
58
+ def test_settings_settings_filepath_types_fails(value):
59
+ with pytest.raises(TypeError) as exc_info:
60
+ Settings(value)
61
+ assert str(exc_info.value) == "settings_filepath must be a Path object"
62
+
63
+
64
+ @pytest.mark.parametrize(
65
+ ("value"),
66
+ [
67
+ ("settings.toml"),
68
+ (523),
69
+ (["settings.toml"]),
70
+ ],
71
+ )
72
+ def test_settings_default_settings_types_fails(value, settings_filepath):
73
+ with pytest.raises(TypeError) as exc_info:
74
+ Settings(settings_filepath, value)
75
+ assert str(exc_info.value) == "default_settings must be a dictionary or None"
76
+
77
+
78
+ def test_settings_sets_default_settings_if_not_present(settings_filepath: Path):
49
79
  settings = Settings(settings_filepath, default_settings)
50
80
  assert settings.get("foo") is None
51
81
 
@@ -57,7 +87,7 @@ def test_settings_sets_default_settings_if_not_present(settings_filepath: str):
57
87
  assert new_settings.get(k) == v
58
88
 
59
89
 
60
- def test_settings_get_and_set_methods_success(settings_filepath: str):
90
+ def test_settings_get_and_set_methods_success(settings_filepath: Path):
61
91
  settings = Settings(settings_filepath, default_settings)
62
92
 
63
93
  settings.set("string", "string_value")
@@ -93,7 +123,7 @@ def test_settings_get_and_set_methods_success(settings_filepath: str):
93
123
  assert settings.get("emoji") == "😊"
94
124
 
95
125
 
96
- def test_settings_overrides_existing_settings(settings_filepath: str):
126
+ def test_settings_overrides_existing_settings(settings_filepath: Path):
97
127
  settings = Settings(settings_filepath, default_settings)
98
128
 
99
129
  # Set an initial value
@@ -105,14 +135,15 @@ def test_settings_overrides_existing_settings(settings_filepath: str):
105
135
  assert settings.get("name") == "NewName"
106
136
 
107
137
 
108
- def test_settings_handles_non_existent_keys(settings_filepath: str):
138
+ def test_settings_handles_non_existent_keys(settings_filepath: Path):
109
139
  settings = Settings(settings_filepath, default_settings)
110
140
 
111
141
  assert settings.get("non_existent_key") is None
112
142
 
113
143
 
114
- def test_settings_handles_empty_settings_file(settings_filepath: str):
144
+ def test_settings_handles_empty_settings_file(settings_filepath: Path):
115
145
  # Create an empty settings file
146
+ settings_filepath.parent.mkdir(parents=True, exist_ok=True)
116
147
  with Path.open(settings_filepath, "w") as f:
117
148
  f.write("")
118
149
  settings = Settings(settings_filepath, default_settings)
@@ -121,7 +152,16 @@ def test_settings_handles_empty_settings_file(settings_filepath: str):
121
152
  assert settings.get(k) == v
122
153
 
123
154
 
124
- def test_settings_saves_settings_to_file(settings_filepath: str):
155
+ def test_settings_handles_creating_directories_for_new_files(settings_filepath: Path):
156
+ parent_dir = settings_filepath.parent
157
+
158
+ assert not parent_dir.exists(), "Parent directory should not exist before test"
159
+
160
+ settings = Settings(settings_filepath, default_settings)
161
+ assert parent_dir.exists(), "Parent directory should be created by Settings class"
162
+
163
+
164
+ def test_settings_saves_settings_to_file(settings_filepath: Path):
125
165
  settings = Settings(settings_filepath, default_settings)
126
166
 
127
167
  # Set some values
@@ -134,7 +174,7 @@ def test_settings_saves_settings_to_file(settings_filepath: str):
134
174
  assert new_settings.get("mood") == "TestMood"
135
175
 
136
176
 
137
- def test_settings_no_default_settings(settings_filepath: str):
177
+ def test_settings_no_default_settings(settings_filepath: Path):
138
178
  # Test with no default settings
139
179
  settings = Settings(settings_filepath)
140
180
 
@@ -151,7 +191,7 @@ def test_settings_no_default_settings(settings_filepath: str):
151
191
  assert new_settings.get("name") == "NoDefaultName"
152
192
 
153
193
 
154
- def test_settings_with_getitem_and_setitem(settings_filepath: str):
194
+ def test_settings_with_getitem_and_setitem(settings_filepath: Path):
155
195
  settings = Settings(settings_filepath, default_settings)
156
196
 
157
197
  # Test __getitem__
@@ -167,7 +207,7 @@ def test_settings_with_getitem_and_setitem(settings_filepath: str):
167
207
  assert settings["new_key"] == "new_value"
168
208
 
169
209
 
170
- def test_settings_updates_defaults_with_nested_dict(settings_filepath: str):
210
+ def test_settings_updates_defaults_with_nested_dict(settings_filepath: Path):
171
211
  settings = Settings(settings_filepath, default_settings)
172
212
  assert settings.get("dictionary.subdictionary.key3") is None
173
213
  assert settings["dictionary.subdictionary.key3"] is None
@@ -180,7 +220,7 @@ def test_settings_updates_defaults_with_nested_dict(settings_filepath: str):
180
220
  assert new_settings["dictionary"]["subdictionary"]["key3"] == "subvalue3"
181
221
 
182
222
 
183
- def test_settings_initializes_defaults_with_nested_dict(settings_filepath: str):
223
+ def test_settings_initializes_defaults_with_nested_dict(settings_filepath: Path):
184
224
  settings = Settings(settings_filepath, default_settings2)
185
225
  assert settings.get("settings.name") == "MyName"
186
226
  assert settings.get("settings.mood") == "MyMood"
@@ -197,7 +237,7 @@ def test_settings_initializes_defaults_with_nested_dict(settings_filepath: str):
197
237
  assert settings.get("settings") == {"gui": {"theme": {"ios": "dark"}}, "mood": "MyMood", "name": "MyName"}
198
238
 
199
239
 
200
- def test_settings_sets_default_settings_of_nested_dictionaries_if_not_present(settings_filepath: str):
240
+ def test_settings_sets_default_settings_of_nested_dictionaries_if_not_present(settings_filepath: Path):
201
241
  settings = Settings(settings_filepath, default_settings2)
202
242
  assert settings.get("settings.gui.theme.ios") == "dark"
203
243
  assert settings.get("settings.gui.theme.android") is None
@@ -214,14 +254,7 @@ def test_settings_sets_default_settings_of_nested_dictionaries_if_not_present(se
214
254
  assert new_settings.get("settings.gui.theme.android") == "light"
215
255
 
216
256
 
217
- def test_settings_home_directory():
218
- settings = Settings(Path("settings.toml"))
219
- home_dir = settings.home_directory()
220
- assert home_dir.is_dir() # Check if the home directory exists
221
- assert home_dir == Path.home() # Ensure it matches the actual home directory
222
-
223
-
224
- def test_settings_dynamic_reload_true(settings_filepath: str):
257
+ def test_settings_dynamic_reload_true(settings_filepath: Path):
225
258
  settings = Settings(settings_filepath, default_settings)
226
259
 
227
260
  assert settings.get("settings.name") == "MyName"
@@ -234,7 +267,7 @@ def test_settings_dynamic_reload_true(settings_filepath: str):
234
267
  assert settings.get("settings.name") == "NewName"
235
268
 
236
269
 
237
- def test_settings_dynamic_reload_false(settings_filepath: str):
270
+ def test_settings_dynamic_reload_false(settings_filepath: Path):
238
271
  settings = Settings(settings_filepath, default_settings)
239
272
  settings.dynamic_reload = False
240
273
 
@@ -244,5 +277,9 @@ def test_settings_dynamic_reload_false(settings_filepath: str):
244
277
  settings2 = Settings(settings_filepath, default_settings)
245
278
  settings2.set("settings.name", "NewName")
246
279
 
247
- # Verify that the change is reflected in the original settings object
248
- assert settings.get("settings.name") == "MyName"
280
+
281
+ # Verify that the change is reflected in the original settings object
282
+ def test_settings_repr_returns_expected_string(settings_filepath: Path):
283
+ settings = Settings(settings_filepath, default_settings)
284
+ expected = f"Settings Stored at: {settings_filepath}"
285
+ assert repr(settings) == expected
@@ -1,4 +0,0 @@
1
-
2
- from mooch.settings.settings import Settings
3
-
4
- __all__ = ["Settings"]