python-time-functions 2.3.0__tar.gz → 2.5.0__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 (17) hide show
  1. {python_time_functions-2.3.0/src/python_time_functions.egg-info → python_time_functions-2.5.0}/PKG-INFO +16 -12
  2. python_time_functions-2.5.0/README.md +35 -0
  3. {python_time_functions-2.3.0 → python_time_functions-2.5.0}/pyproject.toml +1 -1
  4. {python_time_functions-2.3.0 → python_time_functions-2.5.0/src/python_time_functions.egg-info}/PKG-INFO +16 -12
  5. {python_time_functions-2.3.0 → python_time_functions-2.5.0}/src/python_time_functions.egg-info/SOURCES.txt +2 -2
  6. python_time_functions-2.5.0/src/python_time_functions.egg-info/top_level.txt +1 -0
  7. python_time_functions-2.5.0/tests/test_time_function_sanitizer.py +64 -0
  8. python_time_functions-2.5.0/tests/test_time_functions.py +219 -0
  9. python_time_functions-2.3.0/README.md +0 -31
  10. python_time_functions-2.3.0/src/python_time_functions.egg-info/top_level.txt +0 -1
  11. python_time_functions-2.3.0/tests/test_time_function_sanitizer.py +0 -64
  12. python_time_functions-2.3.0/tests/test_time_functions.py +0 -219
  13. {python_time_functions-2.3.0 → python_time_functions-2.5.0}/LICENSE +0 -0
  14. {python_time_functions-2.3.0 → python_time_functions-2.5.0}/setup.cfg +0 -0
  15. {python_time_functions-2.3.0/src/time_functions → python_time_functions-2.5.0/src/python_time_functions}/__init__.py +0 -0
  16. /python_time_functions-2.3.0/src/time_functions/functions.py → /python_time_functions-2.5.0/src/python_time_functions/time_functions.py +0 -0
  17. {python_time_functions-2.3.0 → python_time_functions-2.5.0}/src/python_time_functions.egg-info/dependency_links.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_time_functions
3
- Version: 2.3.0
3
+ Version: 2.5.0
4
4
  Summary: Common Python functions for time handling
5
5
  Author-email: Corne Bester <corne.bester@gmail.com>
6
6
  Project-URL: Homepage, https://example.com
@@ -17,30 +17,34 @@ Dynamic: license-file
17
17
 
18
18
  Common Python functions for time handling
19
19
 
20
+ ```shell
21
+ pip install --upgrade python_time_functions
22
+ ```
23
+
20
24
  ```python
21
25
  from datetime import datetime, timezone
22
-
23
- import time_functions.time_functions as time_functions
24
- # OR
25
- from time_functions.time_functions import get_timestamp_unix_millis
26
+ from python_time_functions import time_functions as tf
26
27
 
27
28
  timestamp = datetime.now(timezone.utc)
28
- unix_millis = get_timestamp_unix_millis(timestamp) # create unix timestamp from obj above
29
+ unix_millis = tf.get_timestamp_unix_millis(timestamp) # create unix timestamp from obj above
29
30
 
30
31
  ```
31
32
 
32
33
  ## local dev
33
34
 
34
- pip install -r requirements.txt
35
-
35
+ ```shell
36
+ pip install -r requirements.txt
37
+ ```
36
38
 
37
39
  ## test
38
40
 
39
- pytest
40
-
41
+ ```shell
42
+ pytest
43
+ ```
41
44
 
42
45
  ### other
43
46
 
44
- pip3 freeze > requirements.txt
45
-
47
+ ```shell
48
+ pip3 freeze > requirements.txt
49
+ ```
46
50
 
@@ -0,0 +1,35 @@
1
+ # Readme
2
+
3
+ Common Python functions for time handling
4
+
5
+ ```shell
6
+ pip install --upgrade python_time_functions
7
+ ```
8
+
9
+ ```python
10
+ from datetime import datetime, timezone
11
+ from python_time_functions import time_functions as tf
12
+
13
+ timestamp = datetime.now(timezone.utc)
14
+ unix_millis = tf.get_timestamp_unix_millis(timestamp) # create unix timestamp from obj above
15
+
16
+ ```
17
+
18
+ ## local dev
19
+
20
+ ```shell
21
+ pip install -r requirements.txt
22
+ ```
23
+
24
+ ## test
25
+
26
+ ```shell
27
+ pytest
28
+ ```
29
+
30
+ ### other
31
+
32
+ ```shell
33
+ pip3 freeze > requirements.txt
34
+ ```
35
+
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python_time_functions"
7
- version = "2.3.0"
7
+ version = "2.5.0"
8
8
  description = "Common Python functions for time handling"
9
9
  requires-python = ">=3.10"
10
10
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_time_functions
3
- Version: 2.3.0
3
+ Version: 2.5.0
4
4
  Summary: Common Python functions for time handling
5
5
  Author-email: Corne Bester <corne.bester@gmail.com>
6
6
  Project-URL: Homepage, https://example.com
@@ -17,30 +17,34 @@ Dynamic: license-file
17
17
 
18
18
  Common Python functions for time handling
19
19
 
20
+ ```shell
21
+ pip install --upgrade python_time_functions
22
+ ```
23
+
20
24
  ```python
21
25
  from datetime import datetime, timezone
22
-
23
- import time_functions.time_functions as time_functions
24
- # OR
25
- from time_functions.time_functions import get_timestamp_unix_millis
26
+ from python_time_functions import time_functions as tf
26
27
 
27
28
  timestamp = datetime.now(timezone.utc)
28
- unix_millis = get_timestamp_unix_millis(timestamp) # create unix timestamp from obj above
29
+ unix_millis = tf.get_timestamp_unix_millis(timestamp) # create unix timestamp from obj above
29
30
 
30
31
  ```
31
32
 
32
33
  ## local dev
33
34
 
34
- pip install -r requirements.txt
35
-
35
+ ```shell
36
+ pip install -r requirements.txt
37
+ ```
36
38
 
37
39
  ## test
38
40
 
39
- pytest
40
-
41
+ ```shell
42
+ pytest
43
+ ```
41
44
 
42
45
  ### other
43
46
 
44
- pip3 freeze > requirements.txt
45
-
47
+ ```shell
48
+ pip3 freeze > requirements.txt
49
+ ```
46
50
 
@@ -1,11 +1,11 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
+ src/python_time_functions/__init__.py
5
+ src/python_time_functions/time_functions.py
4
6
  src/python_time_functions.egg-info/PKG-INFO
5
7
  src/python_time_functions.egg-info/SOURCES.txt
6
8
  src/python_time_functions.egg-info/dependency_links.txt
7
9
  src/python_time_functions.egg-info/top_level.txt
8
- src/time_functions/__init__.py
9
- src/time_functions/functions.py
10
10
  tests/test_time_function_sanitizer.py
11
11
  tests/test_time_functions.py
@@ -0,0 +1,64 @@
1
+ import src.python_time_functions.time_functions as time_functions
2
+
3
+
4
+ def test_convertions_from_sample24():
5
+ """
6
+ # unix seconds
7
+ """
8
+ assert time_functions.timestamp_sanitizer_psql(1742758997) == 1742758997
9
+
10
+
11
+ def test_convertions_from_sample25():
12
+ """
13
+ # unix millis
14
+ """
15
+ assert time_functions.timestamp_sanitizer_psql(1742758997018) == 1742758997.018
16
+
17
+
18
+ def test_convertions_from_sample26():
19
+ """
20
+ # unix micros
21
+ """
22
+ assert time_functions.timestamp_sanitizer_psql(1742758997018308) == 1742758997.018
23
+
24
+
25
+ def test_convertions_from_sample27():
26
+ """
27
+ # unix micros
28
+ """
29
+ assert time_functions.timestamp_sanitizer_psql(1742758997018308) == 1742758997.018
30
+
31
+
32
+ def test_convertions_from_sample28():
33
+ """
34
+ # psql special
35
+ """
36
+ assert time_functions.timestamp_sanitizer_psql(1742758997.018308) == 1742758997.018
37
+
38
+
39
+ def test_convertions_from_sample29():
40
+ """
41
+ # psql special
42
+ """
43
+ assert time_functions.timestamp_sanitizer_psql(1742758997.018) == 1742758997.018
44
+
45
+
46
+ def test_convertions_from_sample30():
47
+ """
48
+ # bad format
49
+ """
50
+ assert time_functions.timestamp_sanitizer_psql(1742758997018.308) == 1742758997.018
51
+
52
+
53
+ def test_convertions_from_sample31():
54
+ """
55
+ # bad format
56
+ """
57
+ assert (
58
+ time_functions.timestamp_sanitizer_psql("2025-03-23T19:43:17.018Z")
59
+ == 1742758997.018
60
+ )
61
+
62
+
63
+ def test_convertions_from_sample32():
64
+ assert time_functions.timestamp_sanitizer_psql(1742742625002.908) == 1742742625.002
@@ -0,0 +1,219 @@
1
+ from datetime import datetime, timezone
2
+ import src.python_time_functions.time_functions as time_functions
3
+
4
+
5
+ new_obj = datetime.now(timezone.utc)
6
+
7
+ iso = time_functions.get_timestamp_iso8601(new_obj)
8
+ iso_millis = time_functions.get_timestamp_iso8601_millis(new_obj)
9
+ iso_micros = time_functions.get_timestamp_iso8601_micros(new_obj)
10
+
11
+
12
+ unix = time_functions.get_timestamp_unix(new_obj)
13
+ unix_millis = time_functions.get_timestamp_unix_millis(new_obj)
14
+ unix_micros = time_functions.get_timestamp_unix_micros(new_obj)
15
+ unix_with_subseconds = time_functions.get_timestamp_unix_subseconds_decimal(new_obj)
16
+
17
+
18
+ obj_from_iso = time_functions.convert_iso_string_to_datetime_obj(iso)
19
+ obj_from_iso_millis = time_functions.convert_iso_string_to_datetime_obj(iso_millis)
20
+ obj_from_iso_micros = time_functions.convert_iso_string_to_datetime_obj(iso_micros)
21
+
22
+ obj_from_unix_seconds = time_functions.convert_unix_to_datetime_obj(unix)
23
+ obj_from_unix_milliseconds = time_functions.convert_unix_to_datetime_obj(unix_millis)
24
+ obj_from_unix_microseconds = time_functions.convert_unix_to_datetime_obj(unix_micros)
25
+
26
+ obj_from_unix_seconds_float_millis = time_functions.convert_unix_to_datetime_obj(
27
+ unix_millis / 1000
28
+ )
29
+ obj_from_unix_seconds_float_micros = time_functions.convert_unix_to_datetime_obj(
30
+ unix_micros / 1000000
31
+ )
32
+ obj_from_unix_seconds_float = time_functions.convert_unix_to_datetime_obj(
33
+ unix_with_subseconds
34
+ )
35
+
36
+
37
+ def test_convertions_from_sample():
38
+ assert time_functions.convert_unix_to_datetime_obj(
39
+ 1742736574
40
+ ) == time_functions.convert_iso_string_to_datetime_obj("2025-03-23T13:29:34+00:00")
41
+
42
+
43
+ def test_convertions_from_sample2():
44
+ assert time_functions.convert_unix_to_datetime_obj(
45
+ 1742737159020
46
+ ) == time_functions.convert_iso_string_to_datetime_obj("2025-03-23T13:39:19.020Z")
47
+
48
+
49
+ def test_convertions_from_sample3():
50
+ assert time_functions.convert_unix_to_datetime_obj(
51
+ 1742737771434946
52
+ ) == time_functions.convert_iso_string_to_datetime_obj(
53
+ "2025-03-23T13:49:31.434946Z"
54
+ )
55
+
56
+
57
+ def test_convertions_from_sample4():
58
+ assert time_functions.convert_unix_to_datetime_obj(
59
+ unix
60
+ ) == time_functions.convert_iso_string_to_datetime_obj(iso)
61
+
62
+
63
+ def test_convertions_from_sample5():
64
+ assert time_functions.convert_unix_to_datetime_obj(
65
+ unix_millis
66
+ ) == time_functions.convert_iso_string_to_datetime_obj(iso_millis)
67
+
68
+
69
+ def test_convertions_from_sample6():
70
+ assert time_functions.convert_unix_to_datetime_obj(
71
+ unix_micros
72
+ ) == time_functions.convert_iso_string_to_datetime_obj(iso_micros)
73
+
74
+
75
+ def test_convertions_from_sample7():
76
+ assert obj_from_iso == obj_from_unix_seconds
77
+
78
+
79
+ def test_convertions_from_sample8():
80
+ assert obj_from_iso_millis == obj_from_unix_milliseconds
81
+
82
+
83
+ def test_convertions_from_sample9():
84
+ assert obj_from_iso_micros == obj_from_unix_microseconds
85
+
86
+
87
+ def test_convertions_from_sample10():
88
+ assert obj_from_iso_millis == obj_from_unix_seconds_float_millis
89
+
90
+
91
+ def test_convertions_from_sample11():
92
+ assert obj_from_iso_micros == obj_from_unix_seconds_float_micros
93
+
94
+
95
+ def test_convertions_from_sample12():
96
+ assert obj_from_iso_micros == obj_from_unix_seconds_float
97
+
98
+
99
+ def test_convertions_from_sample13():
100
+ assert time_functions.convert_unix_to_datetime_obj(
101
+ unix_with_subseconds
102
+ ) == time_functions.convert_iso_string_to_datetime_obj(iso_micros)
103
+
104
+
105
+ def test_convertions_from_sample14():
106
+ """
107
+ # obj_from_iso = time_functions.convert_iso_string_to_datetime_obj("2025-03-23T15:10:25Z")
108
+ # unix_with_subseconds = int(time_functions.get_timestamp_unix_subseconds_decimal(obj_from_iso))
109
+ # unix_with_subseconds == 1742742625
110
+ """
111
+ assert (
112
+ time_functions.timestamp_parser_psql_millis("2025-03-23T15:10:25Z")
113
+ == 1742742625
114
+ )
115
+
116
+
117
+ def test_convertions_from_sample15():
118
+ """
119
+ # obj_from_iso = time_functions.convert_iso_string_to_datetime_obj("2025-03-23T15:10:25.002Z")
120
+ # unix_with_subseconds = time_functions.get_timestamp_unix_subseconds_decimal(obj_from_iso)
121
+ # unix_with_subseconds == 1742742625.002
122
+ """
123
+ assert (
124
+ time_functions.timestamp_parser_psql_millis("2025-03-23T15:10:25.002Z")
125
+ == 1742742625.002
126
+ )
127
+
128
+
129
+ def test_convertions_from_sample16():
130
+ """
131
+ # obj_from_iso = time_functions.convert_iso_string_to_datetime_obj("2025-03-23T15:10:25.002908Z")
132
+ # unix_with_subseconds = time_functions.get_timestamp_unix_subseconds_decimal(obj_from_iso)
133
+ # unix_with_subseconds == 1742742625.002908
134
+ """
135
+ assert (
136
+ time_functions.timestamp_parser_psql_millis("2025-03-23T15:10:25.002908Z")
137
+ == 1742742625.002
138
+ )
139
+
140
+
141
+ def test_convertions_from_sample17():
142
+ assert time_functions.timestamp_parser_psql_millis(1742742625) == 1742742625
143
+
144
+
145
+ def test_convertions_from_sample18():
146
+ """
147
+ postgresql timeformat
148
+ """
149
+ assert time_functions.timestamp_parser_psql_millis(1742742625.0) == 1742742625.0
150
+
151
+
152
+ def test_convertions_from_sample19():
153
+ """
154
+ postgresql timeformat
155
+ """
156
+ assert time_functions.timestamp_parser_psql_millis(1742742625.002) == 1742742625.002
157
+
158
+
159
+ def test_convertions_from_sample20():
160
+ """
161
+ postgresql timeformat
162
+ """
163
+ assert (
164
+ time_functions.timestamp_parser_psql_millis(1742742625.002908) == 1742742625.002
165
+ )
166
+
167
+
168
+ def test_convertions_from_sample21():
169
+ """
170
+ python millis timeformat
171
+ """
172
+ assert time_functions.timestamp_parser_psql_millis(1742742625002) == 1742742625.002
173
+
174
+
175
+ def test_convertions_from_sample22():
176
+ """
177
+ python micros timeformat
178
+ """
179
+ assert (
180
+ time_functions.timestamp_parser_psql_millis(1742742625002908) == 1742742625.002
181
+ )
182
+
183
+
184
+ def test_convertions_from_sample33():
185
+ """
186
+ postgresql nano timeformat
187
+ """
188
+ assert (
189
+ time_functions.timestamp_parser_psql_millis(1742742625.002908123)
190
+ == 1742742625.002
191
+ )
192
+
193
+
194
+ def test_convertions_from_sample32():
195
+ """
196
+ bad timeformat
197
+ """
198
+ assert time_functions.timestamp_parser_psql_millis(1742742625002.908) is None
199
+
200
+
201
+ def test_convertions_from_sample34():
202
+ """
203
+ bad timeformat
204
+ """
205
+ assert time_functions.timestamp_sanitizer_psql(1729755232184) == 1729755232.184
206
+
207
+
208
+ def test_convertions_from_sample35():
209
+ """
210
+ bad timeformat
211
+ """
212
+ assert time_functions.timestamp_sanitizer_psql(1729765227856.3) == 1729765227.856
213
+
214
+
215
+ def test_convertions_from_sample36():
216
+ """
217
+ bad timeformat
218
+ """
219
+ assert time_functions.timestamp_sanitizer_psql(1729765228327.051) == 1729765228.327
@@ -1,31 +0,0 @@
1
- # Readme
2
-
3
- Common Python functions for time handling
4
-
5
- ```python
6
- from datetime import datetime, timezone
7
-
8
- import time_functions.time_functions as time_functions
9
- # OR
10
- from time_functions.time_functions import get_timestamp_unix_millis
11
-
12
- timestamp = datetime.now(timezone.utc)
13
- unix_millis = get_timestamp_unix_millis(timestamp) # create unix timestamp from obj above
14
-
15
- ```
16
-
17
- ## local dev
18
-
19
- pip install -r requirements.txt
20
-
21
-
22
- ## test
23
-
24
- pytest
25
-
26
-
27
- ### other
28
-
29
- pip3 freeze > requirements.txt
30
-
31
-
@@ -1,64 +0,0 @@
1
- import src.time_functions.functions as functions
2
-
3
-
4
- def test_convertions_from_sample24():
5
- """
6
- # unix seconds
7
- """
8
- assert functions.timestamp_sanitizer_psql(1742758997) == 1742758997
9
-
10
-
11
- def test_convertions_from_sample25():
12
- """
13
- # unix millis
14
- """
15
- assert functions.timestamp_sanitizer_psql(1742758997018) == 1742758997.018
16
-
17
-
18
- def test_convertions_from_sample26():
19
- """
20
- # unix micros
21
- """
22
- assert functions.timestamp_sanitizer_psql(1742758997018308) == 1742758997.018
23
-
24
-
25
- def test_convertions_from_sample27():
26
- """
27
- # unix micros
28
- """
29
- assert functions.timestamp_sanitizer_psql(1742758997018308) == 1742758997.018
30
-
31
-
32
- def test_convertions_from_sample28():
33
- """
34
- # psql special
35
- """
36
- assert functions.timestamp_sanitizer_psql(1742758997.018308) == 1742758997.018
37
-
38
-
39
- def test_convertions_from_sample29():
40
- """
41
- # psql special
42
- """
43
- assert functions.timestamp_sanitizer_psql(1742758997.018) == 1742758997.018
44
-
45
-
46
- def test_convertions_from_sample30():
47
- """
48
- # bad format
49
- """
50
- assert functions.timestamp_sanitizer_psql(1742758997018.308) == 1742758997.018
51
-
52
-
53
- def test_convertions_from_sample31():
54
- """
55
- # bad format
56
- """
57
- assert (
58
- functions.timestamp_sanitizer_psql("2025-03-23T19:43:17.018Z")
59
- == 1742758997.018
60
- )
61
-
62
-
63
- def test_convertions_from_sample32():
64
- assert functions.timestamp_sanitizer_psql(1742742625002.908) == 1742742625.002
@@ -1,219 +0,0 @@
1
- from datetime import datetime, timezone
2
- import src.time_functions.functions as functions
3
-
4
-
5
- new_obj = datetime.now(timezone.utc)
6
-
7
- iso = functions.get_timestamp_iso8601(new_obj)
8
- iso_millis = functions.get_timestamp_iso8601_millis(new_obj)
9
- iso_micros = functions.get_timestamp_iso8601_micros(new_obj)
10
-
11
-
12
- unix = functions.get_timestamp_unix(new_obj)
13
- unix_millis = functions.get_timestamp_unix_millis(new_obj)
14
- unix_micros = functions.get_timestamp_unix_micros(new_obj)
15
- unix_with_subseconds = functions.get_timestamp_unix_subseconds_decimal(new_obj)
16
-
17
-
18
- obj_from_iso = functions.convert_iso_string_to_datetime_obj(iso)
19
- obj_from_iso_millis = functions.convert_iso_string_to_datetime_obj(iso_millis)
20
- obj_from_iso_micros = functions.convert_iso_string_to_datetime_obj(iso_micros)
21
-
22
- obj_from_unix_seconds = functions.convert_unix_to_datetime_obj(unix)
23
- obj_from_unix_milliseconds = functions.convert_unix_to_datetime_obj(unix_millis)
24
- obj_from_unix_microseconds = functions.convert_unix_to_datetime_obj(unix_micros)
25
-
26
- obj_from_unix_seconds_float_millis = functions.convert_unix_to_datetime_obj(
27
- unix_millis / 1000
28
- )
29
- obj_from_unix_seconds_float_micros = functions.convert_unix_to_datetime_obj(
30
- unix_micros / 1000000
31
- )
32
- obj_from_unix_seconds_float = functions.convert_unix_to_datetime_obj(
33
- unix_with_subseconds
34
- )
35
-
36
-
37
- def test_convertions_from_sample():
38
- assert functions.convert_unix_to_datetime_obj(
39
- 1742736574
40
- ) == functions.convert_iso_string_to_datetime_obj("2025-03-23T13:29:34+00:00")
41
-
42
-
43
- def test_convertions_from_sample2():
44
- assert functions.convert_unix_to_datetime_obj(
45
- 1742737159020
46
- ) == functions.convert_iso_string_to_datetime_obj("2025-03-23T13:39:19.020Z")
47
-
48
-
49
- def test_convertions_from_sample3():
50
- assert functions.convert_unix_to_datetime_obj(
51
- 1742737771434946
52
- ) == functions.convert_iso_string_to_datetime_obj(
53
- "2025-03-23T13:49:31.434946Z"
54
- )
55
-
56
-
57
- def test_convertions_from_sample4():
58
- assert functions.convert_unix_to_datetime_obj(
59
- unix
60
- ) == functions.convert_iso_string_to_datetime_obj(iso)
61
-
62
-
63
- def test_convertions_from_sample5():
64
- assert functions.convert_unix_to_datetime_obj(
65
- unix_millis
66
- ) == functions.convert_iso_string_to_datetime_obj(iso_millis)
67
-
68
-
69
- def test_convertions_from_sample6():
70
- assert functions.convert_unix_to_datetime_obj(
71
- unix_micros
72
- ) == functions.convert_iso_string_to_datetime_obj(iso_micros)
73
-
74
-
75
- def test_convertions_from_sample7():
76
- assert obj_from_iso == obj_from_unix_seconds
77
-
78
-
79
- def test_convertions_from_sample8():
80
- assert obj_from_iso_millis == obj_from_unix_milliseconds
81
-
82
-
83
- def test_convertions_from_sample9():
84
- assert obj_from_iso_micros == obj_from_unix_microseconds
85
-
86
-
87
- def test_convertions_from_sample10():
88
- assert obj_from_iso_millis == obj_from_unix_seconds_float_millis
89
-
90
-
91
- def test_convertions_from_sample11():
92
- assert obj_from_iso_micros == obj_from_unix_seconds_float_micros
93
-
94
-
95
- def test_convertions_from_sample12():
96
- assert obj_from_iso_micros == obj_from_unix_seconds_float
97
-
98
-
99
- def test_convertions_from_sample13():
100
- assert functions.convert_unix_to_datetime_obj(
101
- unix_with_subseconds
102
- ) == functions.convert_iso_string_to_datetime_obj(iso_micros)
103
-
104
-
105
- def test_convertions_from_sample14():
106
- """
107
- # obj_from_iso = time_functions.convert_iso_string_to_datetime_obj("2025-03-23T15:10:25Z")
108
- # unix_with_subseconds = int(time_functions.get_timestamp_unix_subseconds_decimal(obj_from_iso))
109
- # unix_with_subseconds == 1742742625
110
- """
111
- assert (
112
- functions.timestamp_parser_psql_millis("2025-03-23T15:10:25Z")
113
- == 1742742625
114
- )
115
-
116
-
117
- def test_convertions_from_sample15():
118
- """
119
- # obj_from_iso = time_functions.convert_iso_string_to_datetime_obj("2025-03-23T15:10:25.002Z")
120
- # unix_with_subseconds = time_functions.get_timestamp_unix_subseconds_decimal(obj_from_iso)
121
- # unix_with_subseconds == 1742742625.002
122
- """
123
- assert (
124
- functions.timestamp_parser_psql_millis("2025-03-23T15:10:25.002Z")
125
- == 1742742625.002
126
- )
127
-
128
-
129
- def test_convertions_from_sample16():
130
- """
131
- # obj_from_iso = time_functions.convert_iso_string_to_datetime_obj("2025-03-23T15:10:25.002908Z")
132
- # unix_with_subseconds = time_functions.get_timestamp_unix_subseconds_decimal(obj_from_iso)
133
- # unix_with_subseconds == 1742742625.002908
134
- """
135
- assert (
136
- functions.timestamp_parser_psql_millis("2025-03-23T15:10:25.002908Z")
137
- == 1742742625.002
138
- )
139
-
140
-
141
- def test_convertions_from_sample17():
142
- assert functions.timestamp_parser_psql_millis(1742742625) == 1742742625
143
-
144
-
145
- def test_convertions_from_sample18():
146
- """
147
- postgresql timeformat
148
- """
149
- assert functions.timestamp_parser_psql_millis(1742742625.0) == 1742742625.0
150
-
151
-
152
- def test_convertions_from_sample19():
153
- """
154
- postgresql timeformat
155
- """
156
- assert functions.timestamp_parser_psql_millis(1742742625.002) == 1742742625.002
157
-
158
-
159
- def test_convertions_from_sample20():
160
- """
161
- postgresql timeformat
162
- """
163
- assert (
164
- functions.timestamp_parser_psql_millis(1742742625.002908) == 1742742625.002
165
- )
166
-
167
-
168
- def test_convertions_from_sample21():
169
- """
170
- python millis timeformat
171
- """
172
- assert functions.timestamp_parser_psql_millis(1742742625002) == 1742742625.002
173
-
174
-
175
- def test_convertions_from_sample22():
176
- """
177
- python micros timeformat
178
- """
179
- assert (
180
- functions.timestamp_parser_psql_millis(1742742625002908) == 1742742625.002
181
- )
182
-
183
-
184
- def test_convertions_from_sample33():
185
- """
186
- postgresql nano timeformat
187
- """
188
- assert (
189
- functions.timestamp_parser_psql_millis(1742742625.002908123)
190
- == 1742742625.002
191
- )
192
-
193
-
194
- def test_convertions_from_sample32():
195
- """
196
- bad timeformat
197
- """
198
- assert functions.timestamp_parser_psql_millis(1742742625002.908) is None
199
-
200
-
201
- def test_convertions_from_sample34():
202
- """
203
- bad timeformat
204
- """
205
- assert functions.timestamp_sanitizer_psql(1729755232184) == 1729755232.184
206
-
207
-
208
- def test_convertions_from_sample35():
209
- """
210
- bad timeformat
211
- """
212
- assert functions.timestamp_sanitizer_psql(1729765227856.3) == 1729765227.856
213
-
214
-
215
- def test_convertions_from_sample36():
216
- """
217
- bad timeformat
218
- """
219
- assert functions.timestamp_sanitizer_psql(1729765228327.051) == 1729765228.327