1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-08-08 22:36:48 +02:00

add __slots__ to timestamp class

This commit is contained in:
Kelly Brazil
2022-10-06 09:05:36 -07:00
parent c06963c3d6
commit 622b3ff9ed
2 changed files with 11 additions and 1 deletions

View File

@ -273,6 +273,8 @@ def input_type_check(data: str) -> None:
class timestamp:
__slots__ = ('string', 'format', 'naive', 'utc')
def __init__(self,
datetime_string: str,
format_hint: Optional[Iterable] = None

View File

@ -73,7 +73,15 @@ class MyTests(unittest.TestCase):
}
for input_string, expected_output in datetime_map.items():
self.assertEqual(jc.utils.timestamp(input_string).__dict__, expected_output)
ts = jc.utils.timestamp(input_string)
ts_dict = {
'string': ts.string,
'format': ts.format,
'naive': ts.naive,
'utc': ts.utc
}
self.assertEqual(ts_dict, expected_output)
def test_utils_convert_to_int(self):
io_map = {