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:
@ -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
|
||||
|
@ -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 = {
|
||||
|
Reference in New Issue
Block a user