python-sdk-local 0.0.39__tar.gz → 0.0.40__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 (22) hide show
  1. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/PKG-INFO +1 -1
  2. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/python_sdk_local.egg-info/PKG-INFO +1 -1
  3. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/python_sdk_local.egg-info/SOURCES.txt +2 -5
  4. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/sdk/src/constants.py +2 -2
  5. python-sdk-local-0.0.40/sdk/src/item.py +12 -0
  6. python-sdk-local-0.0.40/sdk/src/mini_logger.py +61 -0
  7. python-sdk-local-0.0.40/sdk/src/our_object.py +56 -0
  8. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/sdk/src/utilities.py +12 -2
  9. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/setup.py +1 -1
  10. python-sdk-local-0.0.39/sdk/src/mini_logger.py +0 -35
  11. python-sdk-local-0.0.39/sdk/src/our_object.py +0 -52
  12. python-sdk-local-0.0.39/sdk/tests/__init__.py +0 -0
  13. python-sdk-local-0.0.39/sdk/tests/mini_logger_test.py +0 -13
  14. python-sdk-local-0.0.39/sdk/tests/our_object_test.py +0 -63
  15. python-sdk-local-0.0.39/sdk/tests/utilities_test.py +0 -156
  16. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/README.md +0 -0
  17. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/pyproject.toml +0 -0
  18. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/python_sdk_local.egg-info/dependency_links.txt +0 -0
  19. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/python_sdk_local.egg-info/top_level.txt +0 -0
  20. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/sdk/__init__.py +0 -0
  21. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/sdk/src/__init__.py +0 -0
  22. {python-sdk-local-0.0.39 → python-sdk-local-0.0.40}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-local
3
- Version: 0.0.39
3
+ Version: 0.0.40
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles
6
6
  Author: Circles
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-local
3
- Version: 0.0.39
3
+ Version: 0.0.40
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles
6
6
  Author: Circles
@@ -8,10 +8,7 @@ python_sdk_local.egg-info/top_level.txt
8
8
  sdk/__init__.py
9
9
  sdk/src/__init__.py
10
10
  sdk/src/constants.py
11
+ sdk/src/item.py
11
12
  sdk/src/mini_logger.py
12
13
  sdk/src/our_object.py
13
- sdk/src/utilities.py
14
- sdk/tests/__init__.py
15
- sdk/tests/mini_logger_test.py
16
- sdk/tests/our_object_test.py
17
- sdk/tests/utilities_test.py
14
+ sdk/src/utilities.py
@@ -7,7 +7,7 @@ OBJECT_TO_INSERT_CODE = {
7
7
  'component_id': PYTHON_SDK_LOCAL_COMPONENT_ID,
8
8
  'component_name': PYTHON_SDK_LOCAL_COMPONENT_NAME,
9
9
  'component_category': LoggerComponentEnum.ComponentCategory.Code.value,
10
- 'developer_email': 'tal.g@circ.zone'
10
+ 'developer_email': 'sahar.g@circ.zone'
11
11
  }
12
12
 
13
13
  OBJECT_TO_INSERT_TEST = {
@@ -15,5 +15,5 @@ OBJECT_TO_INSERT_TEST = {
15
15
  'component_name': PYTHON_SDK_LOCAL_COMPONENT_NAME,
16
16
  'component_category': LoggerComponentEnum.ComponentCategory.Unit_Test.value,
17
17
  'testing_framework': LoggerComponentEnum.testingFramework.pytest.value,
18
- 'developer_email': 'tal.g@circ.zone'
18
+ 'developer_email': 'sahar.g@circ.zone'
19
19
  }
@@ -0,0 +1,12 @@
1
+ from abc import abstractmethod
2
+ from .our_object import OurObject
3
+
4
+
5
+ class Item(OurObject):
6
+
7
+ def __init__(self, **kwargs):
8
+ super().__init__(**kwargs)
9
+
10
+ @abstractmethod
11
+ def get_id(self):
12
+ pass # This method needs to be implemented in subclasses
@@ -0,0 +1,61 @@
1
+ import sys
2
+ from datetime import datetime
3
+
4
+
5
+ class MiniLogger:
6
+
7
+ @staticmethod
8
+ def start(message: str, object: dict = None):
9
+ """
10
+ Print a log message with the current time.
11
+
12
+ Parameters:
13
+ message (str): The message to be printed.
14
+ """
15
+ if object is None:
16
+ print(f"{datetime.now()} - START - {message}")
17
+ else:
18
+ print(f"{datetime.now()} - START - {message} - {object}")
19
+
20
+ @staticmethod
21
+ def end(message: str, object: dict = None):
22
+ """
23
+ Print a log message with the current time.
24
+
25
+ Parameters:
26
+ message (str): The message to be printed.
27
+ """
28
+ if object is None:
29
+ print(f"{datetime.now()} - END - {message}")
30
+ else:
31
+ print(f"{datetime.now()} - END - {message} - {object}")
32
+
33
+ @staticmethod
34
+ def info(message: str, object: dict = None):
35
+ """
36
+ Print a log message with the current time.
37
+
38
+ Parameters:
39
+ message (str): The message to be printed.
40
+ object (dict): The object to be printed.
41
+ """
42
+ if object is None:
43
+ print(f"{datetime.now()} - INFO - {message}")
44
+ else:
45
+ print(f"{datetime.now()} - INFO {message} - {object}")
46
+
47
+ @staticmethod
48
+ def error(message: str, object: dict = None):
49
+ """
50
+ Print a log error message with the current time.
51
+
52
+ Parameters:
53
+ message (str): The message to be printed.
54
+ object (dict): The object to be printed.
55
+ """
56
+ if object is None:
57
+ print(f"{datetime.now()} - ERROR - {message}",
58
+ file=sys.stderr)
59
+ else:
60
+ print(
61
+ f"{datetime.now()} - ERROR - {message} - {object}", file=sys.stderr)
@@ -0,0 +1,56 @@
1
+ from __future__ import annotations
2
+ import json
3
+ import sys
4
+ import os
5
+ from dotenv import load_dotenv
6
+ sys.path.append(os.getcwd())
7
+ from .constants import * # noqa: E402
8
+ load_dotenv()
9
+ from logger_local.Logger import Logger # noqa: E402
10
+ from abc import ABC, abstractmethod # noqa: E402
11
+
12
+ logger = Logger.create_logger(object=OBJECT_TO_INSERT_CODE)
13
+
14
+
15
+ class OurObject(ABC):
16
+
17
+ def __init__(self, **kwargs):
18
+ INIT_METHOD_NAME = '__init__'
19
+ logger.start(INIT_METHOD_NAME, object={'kwargs': kwargs})
20
+ self.kwargs = kwargs
21
+ logger.end(INIT_METHOD_NAME, object={'kwargs': kwargs})
22
+
23
+ @abstractmethod
24
+ def get_name(self):
25
+ pass # This method needs to be implemented in subclasses
26
+
27
+ def get(self, attr_name: str):
28
+ GET_METHOD_NAME = 'get'
29
+ logger.start(GET_METHOD_NAME, object={'attr_name': attr_name})
30
+ arguments = getattr(self, 'kwargs', None)
31
+ value = arguments.get(attr_name, None)
32
+ logger.end(GET_METHOD_NAME, object={'attr_name': attr_name})
33
+ return value
34
+
35
+ def get_all_arguments(self):
36
+ return getattr(self, 'kwargs', None)
37
+
38
+ def to_json(self) -> str:
39
+ return json.dumps(self.__dict__)
40
+
41
+ def from_json(self, json_string: str) -> OurObject:
42
+ FROM_JSON_METHOD_NAME = 'from_json'
43
+ logger.start(FROM_JSON_METHOD_NAME,
44
+ object={'json_string': json_string})
45
+ self.__dict__ = json.loads(json_string)
46
+ logger.end(FROM_JSON_METHOD_NAME,
47
+ object={'json_dict': self.__dict__})
48
+ return self
49
+
50
+ def __eq__(self, other) -> bool:
51
+ if not isinstance(other, OurObject):
52
+ return False
53
+ return self.__dict__ == other.__dict__
54
+
55
+ def __ne__(self, other) -> bool:
56
+ return not self.__eq__(other)
@@ -1,8 +1,10 @@
1
1
  import sys
2
2
  import os
3
- from datetime import time, datetime, timedelta, date
3
+ script_directory = os.path.dirname(os.path.abspath(__file__))
4
+ sys.path.append(os.path.join(script_directory, '..'))
5
+
4
6
  from dotenv import load_dotenv
5
- sys.path.append(os.getcwd())
7
+ from datetime import time, datetime, timedelta, date
6
8
  from .constants import * # noqa: E402¸
7
9
  load_dotenv()
8
10
  from logger_local.Logger import Logger # noqa: E402
@@ -236,3 +238,11 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: tupl
236
238
  logger.end(IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME, object={
237
239
  "is_datetime_in_datetime_range_result": start_datetime <= check_datetime <= end_datetime})
238
240
  return start_datetime <= check_datetime <= end_datetime
241
+
242
+
243
+ def create_http_headers(jwt_token: str):
244
+ headers = {
245
+ 'Content-Type': 'application/json',
246
+ 'Authorization': f'Bearer {jwt_token}',
247
+ }
248
+ return headers
@@ -3,7 +3,7 @@ import setuptools
3
3
  # python -m build needs pyproject.toml or setup.py
4
4
  setuptools.setup(
5
5
  name='python-sdk-local',
6
- version='0.0.39', # https://pypi.org/project/python-sdk-local/
6
+ version='0.0.40', # https://pypi.org/project/python-sdk-local/
7
7
  author="Circles",
8
8
  author_email="info@circles.life",
9
9
  description="PyPI Package for Circles Python SDK Local Python",
@@ -1,35 +0,0 @@
1
- import sys
2
- from datetime import datetime
3
-
4
-
5
- class MiniLogger:
6
-
7
- @staticmethod
8
- def info(message: str, object: dict = None):
9
- """
10
- Print a log message with the current time.
11
-
12
- Parameters:
13
- message (str): The message to be printed.
14
- object (dict): The object to be printed.
15
- """
16
- if object is None:
17
- print(f"{datetime.now()} - {message}")
18
- else:
19
- print(f"{datetime.now()} - {message} - {object}")
20
-
21
- @staticmethod
22
- def error(message: str, object: dict = None):
23
- """
24
- Print a log error message with the current time.
25
-
26
- Parameters:
27
- message (str): The message to be printed.
28
- object (dict): The object to be printed.
29
- """
30
- if object is None:
31
- print(f"{datetime.now()} - ERROR - {message}",
32
- file=sys.stderr)
33
- else:
34
- print(
35
- f"{datetime.now()} - ERROR - {message} - {object}", file=sys.stderr)
@@ -1,52 +0,0 @@
1
- from __future__ import annotations
2
- import json
3
- import sys
4
- import os
5
- from dotenv import load_dotenv
6
- sys.path.append(os.getcwd())
7
- from python_sdk_local.sdk.src.constants import * # noqa: E402
8
- load_dotenv()
9
- # from logger_local.Logger import Logger # noqa: E402
10
-
11
-
12
- # logger = Logger.create_logger(object=OBJECT_TO_INSERT_CODE)
13
-
14
-
15
- class OurObject:
16
-
17
- def __init__(self, **kwargs):
18
- # INIT_METHOD_NAME = '__init__'
19
- # logger.start(INIT_METHOD_NAME, object={'kwargs': kwargs})
20
- self.kwargs = kwargs
21
- # logger.end(INIT_METHOD_NAME, object={'kwargs': kwargs})
22
-
23
- def get(self, attr_name: str):
24
- arguments = getattr(self, 'kwargs', None)
25
- value = arguments.get(attr_name, None)
26
- return value
27
-
28
- def get_all_arguments(self):
29
- return getattr(self, 'kwargs', None)
30
-
31
- def to_json(self) -> str:
32
- return json.dumps(self.__dict__)
33
-
34
- def from_json(self, json_string: str) -> OurObject:
35
- self.__dict__ = json.loads(json_string)
36
- return self
37
-
38
- def __eq__(self, other) -> bool:
39
- if not isinstance(other, OurObject):
40
- return False
41
- return self.__dict__ == other.__dict__
42
-
43
- def __ne__(self, other) -> bool:
44
- return not self.__eq__(other)
45
-
46
- # TODO Shall we call it get_http_headers()? create_http_headers()?
47
- def make_header(self, jwt_token: str):
48
- headers = {
49
- 'Content-Type': 'application/json',
50
- 'Authorization': f'Bearer {jwt_token}',
51
- }
52
- return headers
File without changes
@@ -1,13 +0,0 @@
1
- import os
2
- import sys
3
- sys.path.append(os.getcwd())
4
- from python_sdk_local.sdk.src.mini_logger import MiniLogger
5
-
6
-
7
-
8
- def test_minilogger_info():
9
- MiniLogger.info("test_minilogger_info")
10
-
11
-
12
- def test_minilogger_error():
13
- MiniLogger.error("test_minilogger_error")
@@ -1,63 +0,0 @@
1
- import sys
2
- import os
3
- from dotenv import load_dotenv
4
-
5
- sys.path.append(os.getcwd())
6
- from python_sdk_local.sdk.src import our_object # noqa: E402
7
- from python_sdk_local.sdk.src.constants import * # noqa: E402
8
- load_dotenv()
9
- # from logger_local.Logger import Logger # noqa: E402
10
-
11
- # logger = Logger.create_logger(object=OBJECT_TO_INSERT_TEST)
12
-
13
-
14
- def test_our_object():
15
- # TEST_OUR_OBJECT_FUNCTION_NAME = "test_our_object"
16
- # logger.start(TEST_OUR_OBJECT_FUNCTION_NAME)
17
-
18
- our_object_1 = our_object.OurObject(a=1, b="Our Object Test")
19
- our_object_2 = our_object.OurObject(a=1, b="Our Object Test")
20
- our_object_3 = our_object.OurObject(a="Object3", b=3)
21
-
22
- # Test == and != operators
23
- assert our_object_1 == our_object_2
24
- assert our_object_1 != our_object_3
25
-
26
- # Test get() method
27
- a1 = our_object_1.get('a')
28
- a2 = our_object_2.get('a')
29
- a3 = our_object_3.get('a')
30
- b1 = our_object_1.get('b')
31
- b2 = our_object_2.get('b')
32
- b3 = our_object_3.get('b')
33
-
34
- assert a1 == a2 == 1
35
- assert a3 == "Object3"
36
- assert b1 == b2 == "Our Object Test"
37
- assert b3 == 3
38
-
39
- # Test get_all_arguments() method
40
- assert our_object_1.get_all_arguments() == {'a': 1, 'b': 'Our Object Test'}
41
- assert our_object_2.get_all_arguments() == {'a': 1, 'b': 'Our Object Test'}
42
- assert our_object_3.get_all_arguments() == {'a': 'Object3', 'b': 3}
43
-
44
- # Test to_json() and from_json() methods
45
- our_object_1_json = our_object_1.to_json()
46
- our_object_2_json = our_object_2.to_json()
47
- our_object_3_json = our_object_3.to_json()
48
- assert our_object_1_json == '{"kwargs": {"a": 1, "b": "Our Object Test"}}'
49
- assert our_object_2_json == '{"kwargs": {"a": 1, "b": "Our Object Test"}}'
50
- assert our_object_3_json == '{"kwargs": {"a": "Object3", "b": 3}}'
51
-
52
- our_object4 = our_object.OurObject()
53
- our_object5 = our_object.OurObject()
54
- our_object6 = our_object.OurObject()
55
- assert our_object4.from_json(our_object_1_json) == our_object_1
56
- assert our_object5.from_json(our_object_2_json) == our_object_2
57
- assert our_object6.from_json(our_object_3_json) == our_object_3
58
-
59
- # # Test make_header
60
- # header = our_object_1.make_header(logger.userContext.get_user_JWT())
61
- # assert 'Authorization' in header
62
-
63
- # logger.end(TEST_OUR_OBJECT_FUNCTION_NAME)
@@ -1,156 +0,0 @@
1
- from datetime import time, datetime, timedelta, date
2
- import sys
3
- import os
4
- from dotenv import load_dotenv
5
- from python_sdk_local.sdk.src import utilities
6
- sys.path.append(os.getcwd())
7
- from python_sdk_local.sdk.src.constants import * # noqa: E402
8
- load_dotenv()
9
- from logger_local.Logger import Logger # noqa: E402
10
-
11
- logger = Logger.create_logger(object=OBJECT_TO_INSERT_TEST)
12
-
13
- TEST_TIME_DELTA = timedelta(seconds=25853)
14
- TEST_TIME_FORMAT = "07:10:53"
15
-
16
-
17
- def test_timedelta_to_time_format():
18
- TEST_TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME = "test_timedelta_to_time_format"
19
- logger.start(TEST_TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME)
20
-
21
- time_format = utilities.timedelta_to_time_format(TEST_TIME_DELTA)
22
- assert time_format == TEST_TIME_FORMAT
23
-
24
- logger.end(TEST_TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME)
25
-
26
-
27
- def test_is_list_of_dicts():
28
- TEST_IS_LIST_OF_DICTS_METHOD_NAME = "test_is_list_of_dicts"
29
- logger.start(TEST_IS_LIST_OF_DICTS_METHOD_NAME)
30
-
31
- assert utilities.is_list_of_dicts([]) == True
32
- assert utilities.is_list_of_dicts([{'a': 1}, {'b': 2}]) == True
33
- assert utilities.is_list_of_dicts([{'a': 1}, {'b': 2}, 3]) == False
34
- assert utilities.is_list_of_dicts([{'a': 1}, {'b': 2}, 'c']) == False
35
- assert utilities.is_list_of_dicts([{'a': 1}, {'b': 2}, {'c': 3}]) == True
36
- assert utilities.is_list_of_dicts(
37
- [{'a': 1}, {'b': 2}, {'c': {'d': 5}}, 4]) == False
38
-
39
- logger.end(TEST_IS_LIST_OF_DICTS_METHOD_NAME)
40
-
41
-
42
- def test_is_valid_time_range():
43
- TEST_IS_VALID_TIME_RANGE_METHOD_NAME = "test_is_valid_time_range"
44
- logger.start(TEST_IS_VALID_TIME_RANGE_METHOD_NAME)
45
- valid_time_range = (time(12, 34, 56), time(23, 45, 12))
46
- invalid_time_range = (time(12, 34, 56), time(
47
- 11, 22).hour) # Invalid format
48
-
49
- assert utilities.is_valid_time_range(valid_time_range) is True
50
- assert utilities.is_valid_time_range(invalid_time_range) is False
51
-
52
- logger.end(TEST_IS_VALID_TIME_RANGE_METHOD_NAME)
53
-
54
-
55
- def test_is_valid_date_range():
56
- TEST_IS_VALID_DATE_RANGE_METHOD_NAME = "test_is_valid_date_range"
57
- logger.start(TEST_IS_VALID_DATE_RANGE_METHOD_NAME)
58
- valid_date_range = (date(2023, 10, 26), date(2023, 10, 27))
59
- invalid_date_range = (date(2023, 10, 26), time(
60
- 23, 45, 12)) # Invalid format
61
- check_date_inside = date(2023, 10, 27)
62
- check_date_outside = date(2023, 10, 25)
63
-
64
- assert utilities.is_valid_date_range(valid_date_range) is True
65
- assert utilities.is_valid_date_range(invalid_date_range) is False
66
- assert utilities.is_date_in_date_range(
67
- check_date_inside, valid_date_range) is True
68
- assert utilities.is_date_in_date_range(
69
- check_date_outside, valid_date_range) is False
70
-
71
- logger.end(TEST_IS_VALID_DATE_RANGE_METHOD_NAME)
72
-
73
-
74
- def test_is_valid_datetime_range():
75
- TEST_IS_VALID_DATETIME_RANGE_METHOD_NAME = "test_is_valid_datetime_range"
76
- logger.start(TEST_IS_VALID_DATETIME_RANGE_METHOD_NAME)
77
- valid_datetime_range = (
78
- datetime(2023, 10, 26, 12, 34, 56), datetime(2023, 10, 27, 23, 45, 12))
79
- invalid_datetime_range = (
80
- datetime(2023, 10, 26, 12, 34, 56), time(23, 45, 12)) # Invalid format
81
- check_datetime_inside = datetime(2023, 10, 27, 15, 0, 0)
82
- check_datetime_outside = datetime(2023, 10, 25, 5, 0, 0)
83
-
84
- assert utilities.is_valid_datetime_range(valid_datetime_range) is True
85
- assert utilities.is_valid_datetime_range(invalid_datetime_range) is False
86
- assert utilities.is_datetime_in_datetime_range(
87
- check_datetime_inside, valid_datetime_range) is True
88
- assert utilities.is_datetime_in_datetime_range(
89
- check_datetime_outside, valid_datetime_range) is False
90
- logger.end(TEST_IS_VALID_DATETIME_RANGE_METHOD_NAME)
91
-
92
-
93
- def test_timedelta_to_time_format():
94
- TEST_TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME = "test_timedelta_to_time_format"
95
- logger.start(TEST_TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME)
96
- duration = timedelta(hours=2, minutes=30, seconds=45)
97
- formatted_time = utilities.timedelta_to_time_format(duration)
98
- assert formatted_time == "02:30:45"
99
- logger.end(TEST_TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME)
100
-
101
-
102
- def test_is_time_in_time_range():
103
- TEST_IS_TIME_IN_TIME_RANGE_METHOD_NAME = "test_is_time_in_time_range"
104
- logger.start(TEST_IS_TIME_IN_TIME_RANGE_METHOD_NAME)
105
- valid_time_range = (time(12, 34, 56), time(23, 45, 12))
106
- check_time_inside = time(15, 0, 0)
107
- check_time_outside = time(5, 0, 0)
108
-
109
- assert utilities.is_time_in_time_range(
110
- check_time_inside, valid_time_range) is True
111
- assert utilities.is_time_in_time_range(
112
- check_time_outside, valid_time_range) is False
113
-
114
- logger.end(TEST_IS_TIME_IN_TIME_RANGE_METHOD_NAME)
115
-
116
-
117
- def test_is_date_in_date_range():
118
- TEST_IS_DATE_IN_DATE_RANGE_METHOD_NAME = "test_is_date_in_date_range"
119
- logger.start(TEST_IS_DATE_IN_DATE_RANGE_METHOD_NAME)
120
- valid_date_range = [date(2023, 10, 26), date(2023, 10, 27)]
121
- invalid_date_range = [date(2023, 10, 26), time(
122
- 23, 45, 12)] # Invalid format
123
- check_date_inside = date(2023, 10, 27)
124
- check_date_outside = date(2023, 10, 25)
125
-
126
- assert utilities.is_date_in_date_range(
127
- check_date_inside, valid_date_range) is True
128
- assert utilities.is_date_in_date_range(
129
- check_date_outside, valid_date_range) is False
130
- assert utilities.is_date_in_date_range(
131
- check_date_inside, invalid_date_range) is False
132
-
133
- logger.end(TEST_IS_DATE_IN_DATE_RANGE_METHOD_NAME)
134
-
135
-
136
- def test_is_datetime_in_datetime_range():
137
- TEST_IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME = "test_is_datetime_in_datetime_range"
138
- logger.start(TEST_IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME)
139
- valid_datetime_range = [
140
- datetime(2023, 10, 26, 12, 34, 56), datetime(2023, 10, 27, 23, 45, 12)]
141
- invalid_datetime_range = [
142
- datetime(2023, 10, 26, 12, 34, 56), time(23, 45, 12)] # Invalid format
143
- check_datetime_inside = datetime(2023, 10, 27, 15, 0, 0)
144
- check_datetime_outside = datetime(2023, 10, 25, 5, 0, 0)
145
-
146
- assert utilities.is_datetime_in_datetime_range(
147
- check_datetime_inside, valid_datetime_range) is True
148
- assert utilities.is_datetime_in_datetime_range(
149
- check_datetime_outside, valid_datetime_range) is False
150
- assert utilities.is_datetime_in_datetime_range(
151
- check_datetime_inside, invalid_datetime_range) is False
152
-
153
- logger.end(TEST_IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME)
154
-
155
-
156
-