Skip to content

Commit

Permalink
Restore preamble id
Browse files Browse the repository at this point in the history
Fix #46.
  • Loading branch information
astrojuanlu committed Nov 7, 2019
1 parent 377e5fc commit 21e74a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/czml3/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
class Preamble(BaseCZMLObject):
"""The preamble packet."""

id = attr.ib(init=False, default="document")

version = attr.ib(default=CZML_VERSION)
name = attr.ib(default=None)
clock = attr.ib(default=None)

@property
def id(self):
return "document"


@attr.s(repr=False, frozen=True, kw_only=True)
class Packet(BaseCZMLObject):
Expand Down
12 changes: 12 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from czml3.core import Preamble


def test_empty_preamble_has_id_and_version():
expected_result = """{
"id": "document",
"version": "1.0"
}"""

packet = Preamble()

assert repr(packet) == expected_result

0 comments on commit 21e74a2

Please sign in to comment.