punit 1.1.2__tar.gz → 1.1.4__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 (33) hide show
  1. {punit-1.1.2 → punit-1.1.4}/PKG-INFO +1 -1
  2. {punit-1.1.2 → punit-1.1.4}/punit/__init__.py +1 -1
  3. punit-1.1.4/punit/assertions/collections.py +75 -0
  4. {punit-1.1.2 → punit-1.1.4}/punit.egg-info/PKG-INFO +1 -1
  5. {punit-1.1.2 → punit-1.1.4}/pyproject.toml +1 -1
  6. punit-1.1.2/punit/assertions/collections.py +0 -61
  7. {punit-1.1.2 → punit-1.1.4}/LICENSE +0 -0
  8. {punit-1.1.2 → punit-1.1.4}/README.md +0 -0
  9. {punit-1.1.2 → punit-1.1.4}/punit/TestResult.py +0 -0
  10. {punit-1.1.2 → punit-1.1.4}/punit/__main__.py +0 -0
  11. {punit-1.1.2 → punit-1.1.4}/punit/assertions/__init__.py +0 -0
  12. {punit-1.1.2 → punit-1.1.4}/punit/assertions/exceptions.py +0 -0
  13. {punit-1.1.2 → punit-1.1.4}/punit/assertions/strings.py +0 -0
  14. {punit-1.1.2 → punit-1.1.4}/punit/cli.py +0 -0
  15. {punit-1.1.2 → punit-1.1.4}/punit/discovery/TestModuleDiscovery.py +0 -0
  16. {punit-1.1.2 → punit-1.1.4}/punit/discovery/__init__.py +0 -0
  17. {punit-1.1.2 → punit-1.1.4}/punit/facts/Fact.py +0 -0
  18. {punit-1.1.2 → punit-1.1.4}/punit/facts/FactManager.py +0 -0
  19. {punit-1.1.2 → punit-1.1.4}/punit/facts/__init__.py +0 -0
  20. {punit-1.1.2 → punit-1.1.4}/punit/reports/HtmlReportGenerator.py +0 -0
  21. {punit-1.1.2 → punit-1.1.4}/punit/reports/JUnitReportGenerator.py +0 -0
  22. {punit-1.1.2 → punit-1.1.4}/punit/reports/__init__.py +0 -0
  23. {punit-1.1.2 → punit-1.1.4}/punit/runner.py +0 -0
  24. {punit-1.1.2 → punit-1.1.4}/punit/theories/Theory.py +0 -0
  25. {punit-1.1.2 → punit-1.1.4}/punit/theories/TheoryManager.py +0 -0
  26. {punit-1.1.2 → punit-1.1.4}/punit/theories/__init__.py +0 -0
  27. {punit-1.1.2 → punit-1.1.4}/punit/traits/Trait.py +0 -0
  28. {punit-1.1.2 → punit-1.1.4}/punit/traits/__init__.py +0 -0
  29. {punit-1.1.2 → punit-1.1.4}/punit.egg-info/SOURCES.txt +0 -0
  30. {punit-1.1.2 → punit-1.1.4}/punit.egg-info/dependency_links.txt +0 -0
  31. {punit-1.1.2 → punit-1.1.4}/punit.egg-info/entry_points.txt +0 -0
  32. {punit-1.1.2 → punit-1.1.4}/punit.egg-info/top_level.txt +0 -0
  33. {punit-1.1.2 → punit-1.1.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: punit
3
- Version: 1.1.2
3
+ Version: 1.1.4
4
4
  Summary: A modernized unit-test framework for Python.
5
5
  Author-email: Shaun Wilson <mrshaunwilson@msn.com>
6
6
  Project-URL: Documentation, https://punit.readthedocs.io/
@@ -1,7 +1,7 @@
1
1
  # SPDX-FileCopyrightText: © Shaun Wilson
2
2
  # SPDX-License-Identifier: MIT
3
3
 
4
- __version__ = '1.1.2'
4
+ __version__ = '1.1.4'
5
5
 
6
6
  from .assertions import *
7
7
  from .facts import *
@@ -0,0 +1,75 @@
1
+ # SPDX-FileCopyrightText: © Shaun Wilson
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ from typing import Any, Callable, Sequence
5
+
6
+
7
+ def areSame(a:Sequence[Any]|None, b:Sequence[Any]|None, sort:bool=False, sortFunction:Callable[[Any], Any]=None) -> bool:
8
+ """
9
+ Check if two sequences contain the same elements in the same order.
10
+
11
+ :param Sequence[Any]|None a: The sequence to check
12
+ :param Sequence[Any]|None b: The sequence to compare against
13
+ :param Optional[bool] sort: Sort sequences before performing comparisons.
14
+ :param Optional[Callable[[Any], Any]] sortFunction: Custom function to use when sorting.
15
+ :returns bool: True if the sequences contain the same elements in the same order, False otherwise.
16
+ """
17
+ if a is b:
18
+ return True
19
+ elif a is None and b is not None:
20
+ return False
21
+ elif a is not None and b is None:
22
+ return False
23
+ elif len(a) != len(b):
24
+ return False
25
+
26
+ if sort:
27
+ if isinstance(a, dict) or isinstance(b, dict):
28
+ sortFunction = sortFunction if sortFunction is not None else lambda e: e[0]
29
+ a = sorted(a.items(), key=sortFunction)
30
+ b = sorted(b.items(), key=sortFunction)
31
+ else:
32
+ sortFunction = sortFunction if sortFunction is not None else lambda e: e
33
+ a = sorted(a, key=sortFunction)
34
+ b = sorted(b, key=sortFunction)
35
+
36
+ if isinstance(a, dict) or isinstance(b, dict):
37
+ for pairs in zip(a.items(), b.items()):
38
+ if not areSame(pairs[0], pairs[1]):
39
+ return False
40
+ else:
41
+ for pairs in zip(a, b):
42
+ if isinstance(pairs[0], dict) or isinstance(pairs[1], dict):
43
+ if not areSame(pairs[0], pairs[1]):
44
+ return False
45
+ elif pairs[0] != pairs[1]:
46
+ return False
47
+ return True
48
+
49
+ def hasLength(sequence:Sequence[Any]|None, expected:int|None) -> bool:
50
+ """
51
+ Check if a sequence has the expected number of elements.
52
+
53
+ :param Sequence[Any]|None sequence: The sequence to check
54
+ :param int|None expected: The expected number of elements
55
+
56
+ :returns bool: True if the sequence has exactly the expected number of elements, False otherwise
57
+ """
58
+ if sequence is None and (expected is None or expected == 0):
59
+ return True
60
+ elif sequence is None and (expected is not None and expected != 0):
61
+ return False
62
+ elif sequence is not None and expected is None:
63
+ return False
64
+ return len(sequence) == expected
65
+
66
+ def isNoneOrEmpty(sequence:Sequence[Any]|None) -> bool:
67
+ """
68
+ Check if a sequence is None or empty.
69
+
70
+ :param Sequence[Any]|None sequence: The sequence to check
71
+ :returns bool: True if the sequence is None or empty, False otherwise
72
+ """
73
+ if sequence is None:
74
+ return True
75
+ return len(sequence) == 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: punit
3
- Version: 1.1.2
3
+ Version: 1.1.4
4
4
  Summary: A modernized unit-test framework for Python.
5
5
  Author-email: Shaun Wilson <mrshaunwilson@msn.com>
6
6
  Project-URL: Documentation, https://punit.readthedocs.io/
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "punit"
3
- version = "1.1.2"
3
+ version = "1.1.4"
4
4
  description = "A modernized unit-test framework for Python."
5
5
  keywords = ["test", "unittest", "unit-test"]
6
6
  authors = [
@@ -1,61 +0,0 @@
1
- # SPDX-FileCopyrightText: © Shaun Wilson
2
- # SPDX-License-Identifier: MIT
3
-
4
- from typing import Any, Sequence
5
-
6
- def areSame(a:Sequence[Any]|None, b:Sequence[Any]|None) -> bool:
7
- """
8
- Check if two sequences contain the same elements in the same order.
9
-
10
- Args:
11
- a: The sequence to check
12
- b: The sequence to compare against
13
-
14
- Returns:
15
- True if the sequences contain the same elements in the same order, False otherwise
16
- """
17
- if a is b:
18
- return True
19
- elif a is None and b is not None:
20
- return False
21
- elif a is not None and b is None:
22
- return False
23
- elif len(a) != len(b):
24
- return False
25
- for i in range(len(a)):
26
- if not a[i] == b[i]:
27
- return False
28
- return True
29
-
30
- def hasLength(sequence:Sequence[Any]|None, expected:int|None) -> bool:
31
- """
32
- Check if a sequence has the expected number of elements.
33
-
34
- Args:
35
- sequence: The sequence to check
36
- expected: The expected number of elements
37
-
38
- Returns:
39
- True if the sequence has exactly the expected number of elements, False otherwise
40
- """
41
- if sequence is None and (expected is None or expected == 0):
42
- return True
43
- elif sequence is None and (expected is not None and expected != 0):
44
- return False
45
- elif sequence is not None and expected is None:
46
- return False
47
- return len(sequence) == expected
48
-
49
- def isNoneOrEmpty(sequence:Sequence[Any]|None) -> bool:
50
- """
51
- Check if a sequence is None or empty.
52
-
53
- Args:
54
- sequence: The sequence to check
55
-
56
- Returns:
57
- True if the sequence is None or empty, False otherwise
58
- """
59
- if sequence is None:
60
- return True
61
- return len(sequence) == 0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes