protobin 0.0.50__tar.gz → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: protobin
3
- Version: 0.0.50
3
+ Version: 0.1.0
4
4
  Summary: Python library for encode and decode data in protobin format
5
5
  Project-URL: Homepage, https://github.com/drmelectronic/protobin-python
6
6
  Project-URL: Bug Tracker, https://github.com/drmelectronic/protobin-python/issues
@@ -74,6 +74,7 @@ class Protocol:
74
74
  self.server = server
75
75
  self.headers = {}
76
76
  self.codecs = {}
77
+ self.file = file
77
78
  if file:
78
79
  with open(file, 'r') as f:
79
80
  if 'json' in file:
@@ -85,6 +86,9 @@ class Protocol:
85
86
  else:
86
87
  self.load_format(js)
87
88
 
89
+ def __str__(self):
90
+ return self.file
91
+
88
92
  def load_format(self, js):
89
93
  if 'crc' in js:
90
94
  self.config_crc(js['crc'])
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "protobin"
7
- version = "0.0.50"
7
+ version = "0.1.0"
8
8
  authors = [
9
9
  { name="Daniel Robles", email="drm.electronic@gmail.com" },
10
10
  ]
@@ -457,10 +457,11 @@ class BasicTest(unittest.TestCase):
457
457
  self.assertEqual(data, recv)
458
458
 
459
459
  def test_timestamp(self):
460
- data = {'test': datetime.datetime(2024, 9, 13, 15, 23, 51, 265981)}
460
+ data = {'test': datetime.datetime(2025, 9, 2, 12, 9, 50, 732000)}
461
461
  binary = self.protocol.encode(data, 'timestamp')
462
462
  print(binary)
463
463
  h, recv = self.protocol.decode(binary)
464
+ print('recv', recv)
464
465
  self.assertEqual(data, recv)
465
466
 
466
467
  def test_timestamp6(self):
@@ -477,12 +478,14 @@ class BasicTest(unittest.TestCase):
477
478
  self.assertEqual(data, recv)
478
479
 
479
480
  def test_timestamp_default(self):
480
- data = {'test': datetime.datetime.now()}
481
+ data = {'test': datetime.datetime(2025, 9, 2, 12, 9, 50, 732000)}
482
+ # data = {'test': datetime.datetime.now()}
481
483
  print(data)
482
484
  binary = self.protocol.encode(data, 'timestamp_default')
483
- print(binary)
485
+ print('mio', binary)
486
+ binary = b'\x54\x44\x3d\x01\x99\x0A\x55\x5D\x8C'
484
487
  h, recv = self.protocol.decode(binary)
485
- print(recv)
488
+ print('edu', recv)
486
489
  self.assertEqual(data['test'].replace(microsecond=(data['test'].microsecond // 1000) * 1000), recv['test'])
487
490
 
488
491
  class AdvancedTest(unittest.TestCase):
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