setdoc 1.2.7__tar.gz → 1.2.9__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.
- {setdoc-1.2.7/src/setdoc.egg-info → setdoc-1.2.9}/PKG-INFO +1 -1
- {setdoc-1.2.7 → setdoc-1.2.9}/pyproject.toml +1 -1
- {setdoc-1.2.7 → setdoc-1.2.9}/src/setdoc/core/__init__.py +4 -4
- {setdoc-1.2.7 → setdoc-1.2.9}/src/setdoc/core/cfg.toml +1 -0
- setdoc-1.2.9/src/setdoc/tests/__init__.py +11 -0
- {setdoc-1.2.7 → setdoc-1.2.9}/src/setdoc/tests/test_core.py +7 -2
- {setdoc-1.2.7 → setdoc-1.2.9/src/setdoc.egg-info}/PKG-INFO +1 -1
- setdoc-1.2.7/src/setdoc/tests/__init__.py +0 -11
- {setdoc-1.2.7 → setdoc-1.2.9}/LICENSE.txt +0 -0
- {setdoc-1.2.7 → setdoc-1.2.9}/MANIFEST.in +0 -0
- {setdoc-1.2.7 → setdoc-1.2.9}/README.rst +0 -0
- {setdoc-1.2.7 → setdoc-1.2.9}/setup.cfg +0 -0
- {setdoc-1.2.7 → setdoc-1.2.9}/src/setdoc/__init__.py +0 -0
- {setdoc-1.2.7 → setdoc-1.2.9}/src/setdoc.egg-info/SOURCES.txt +0 -0
- {setdoc-1.2.7 → setdoc-1.2.9}/src/setdoc.egg-info/dependency_links.txt +0 -0
- {setdoc-1.2.7 → setdoc-1.2.9}/src/setdoc.egg-info/top_level.txt +0 -0
|
@@ -5,7 +5,7 @@ import tomllib
|
|
|
5
5
|
from importlib import resources
|
|
6
6
|
from typing import *
|
|
7
7
|
|
|
8
|
-
__all__ = ["SetDoc", "
|
|
8
|
+
__all__ = ["SetDoc", "basic", "getbasicdoc", "setdoc"]
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Util(enum.Enum):
|
|
@@ -14,9 +14,9 @@ class Util(enum.Enum):
|
|
|
14
14
|
@functools.cached_property
|
|
15
15
|
def data(self: Self) -> dict:
|
|
16
16
|
"This cached property holds the cfg data."
|
|
17
|
-
text: str
|
|
18
|
-
|
|
19
|
-
return
|
|
17
|
+
text: str
|
|
18
|
+
text = resources.read_text("setdoc.core", "cfg.toml")
|
|
19
|
+
return tomllib.loads(text)
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
@dataclasses.dataclass
|
|
@@ -5,6 +5,7 @@ __and__ = "This magic method implements self&other."
|
|
|
5
5
|
__bool__ = "This magic method implements bool(self)."
|
|
6
6
|
__call__ = "This magic method implements calling self."
|
|
7
7
|
__ceil__ = "This magic method implements math.ceil(self)."
|
|
8
|
+
__cmp__ = "This magic method implements all six comparison operators at once."
|
|
8
9
|
__complex__ = "This magic method implements complex(self)."
|
|
9
10
|
__contains__ = "This magic method implements other in self."
|
|
10
11
|
__delitem__ = "This magic method implements del self[key]."
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
__all__ = ["test"]
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test() -> unittest.TextTestResult:
|
|
7
|
+
loader: unittest.TestLoader
|
|
8
|
+
suite: unittest.TestSuite
|
|
9
|
+
loader = unittest.TestLoader()
|
|
10
|
+
suite = loader.discover(start_dir="setdoc.tests")
|
|
11
|
+
return unittest.TextTestRunner().run(suite)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import types
|
|
1
2
|
import unittest
|
|
2
3
|
from typing import *
|
|
3
4
|
|
|
@@ -29,6 +30,7 @@ class TestSetDocDecorator(unittest.TestCase):
|
|
|
29
30
|
def my_method(self: Self) -> None:
|
|
30
31
|
pass
|
|
31
32
|
|
|
33
|
+
instance: MyClass
|
|
32
34
|
instance = MyClass()
|
|
33
35
|
self.assertEqual(instance.my_method.__doc__, "This is a test method")
|
|
34
36
|
|
|
@@ -49,7 +51,8 @@ class TestSetDocDecorator(unittest.TestCase):
|
|
|
49
51
|
def __init__(self, x):
|
|
50
52
|
self.x = x
|
|
51
53
|
|
|
52
|
-
instance: InitClass
|
|
54
|
+
instance: InitClass
|
|
55
|
+
instance = InitClass(5)
|
|
53
56
|
self.assertEqual(InitClass.__doc__, "This is a class with __init__")
|
|
54
57
|
self.assertEqual(instance.__doc__, "This is a class with __init__")
|
|
55
58
|
|
|
@@ -72,7 +75,8 @@ class TestSetDocDecorator(unittest.TestCase):
|
|
|
72
75
|
def value(self: Self) -> None:
|
|
73
76
|
return self._value
|
|
74
77
|
|
|
75
|
-
instance: PropertyClass
|
|
78
|
+
instance: PropertyClass
|
|
79
|
+
instance = PropertyClass(10)
|
|
76
80
|
self.assertEqual(PropertyClass.value.__doc__, "This is a property")
|
|
77
81
|
self.assertEqual(instance.value, 10)
|
|
78
82
|
|
|
@@ -95,6 +99,7 @@ class TestSetDocDecorator(unittest.TestCase):
|
|
|
95
99
|
|
|
96
100
|
return inner_func
|
|
97
101
|
|
|
102
|
+
nested_func: types.FunctionType
|
|
98
103
|
nested_func = outer_func()
|
|
99
104
|
self.assertEqual(nested_func.__doc__, "This is a nested function")
|
|
100
105
|
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import unittest
|
|
2
|
-
|
|
3
|
-
__all__ = ["test"]
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def test() -> unittest.TextTestResult:
|
|
7
|
-
loader: unittest.TestLoader = unittest.TestLoader()
|
|
8
|
-
tests: unittest.TestSuite = loader.discover(start_dir="setdoc.tests")
|
|
9
|
-
runner: unittest.TextTestRunner = unittest.TextTestRunner()
|
|
10
|
-
result: unittest.TextTestResult = runner.run(tests)
|
|
11
|
-
return result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|