diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7d4105a..0c8c9c7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,7 +2,7 @@ trigger: - master -name: '1.1.16' +name: '1.1.17' jobs: diff --git a/chapter10/__init__.py b/chapter10/__init__.py index 764ba28..b242e3f 100755 --- a/chapter10/__init__.py +++ b/chapter10/__init__.py @@ -1,3 +1,3 @@ from .c10 import C10, TYPES from .packet import Packet, InvalidPacket -version = '1.1.15' +version = '1.1.17' diff --git a/chapter10/packet.py b/chapter10/packet.py index 51004a9..de768eb 100755 --- a/chapter10/packet.py +++ b/chapter10/packet.py @@ -216,7 +216,7 @@ def __len__(self): return len(self._messages) if hasattr(self, 'count'): return self.count - elif hasattr(self, 'Message') and self.Message.length: + elif getattr(self, 'Message', None) and self.Message.length: msg_size = self.Message.length if getattr(self.Message, 'FORMAT', None): msg_size += self.Message.FORMAT.calcsize() // 8 diff --git a/pyproject.toml b/pyproject.toml index 1671c4c..05f7aee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pychapter10" -version = "0.1.16" +version = "0.1.17" description = "A parser library for the IRIG 106 Chapter 10 data format." authors = [ {name = "Micah Ferrill", email = "ferrillm@avtest.com"}, diff --git a/tests/unit/test_pcm.py b/tests/unit/test_pcm.py index cedab51..c1c606a 100644 --- a/tests/unit/test_pcm.py +++ b/tests/unit/test_pcm.py @@ -35,3 +35,8 @@ def test_packed(packet): def test_throughput(throughput): with pytest.raises(StopIteration): next(throughput) + + +def test_throughput_len(throughput): + with pytest.raises(TypeError): + len(throughput) \ No newline at end of file