-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from vkottler/dev/protocol-dev
Dev/protocol dev
- Loading branch information
Showing
14 changed files
with
1,625 additions
and
1,135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
major: 0 | ||
minor: 12 | ||
patch: 3 | ||
minor: 13 | ||
patch: 0 | ||
entry: runtimepy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
A module implementing a telemetry interface. | ||
""" | ||
|
||
# internal | ||
from runtimepy.enum.registry import RuntimeIntEnum as _RuntimeIntEnum | ||
|
||
|
||
class MessageType(_RuntimeIntEnum): | ||
"""An enumeration of viable message types.""" | ||
|
||
PROTOCOL_META = 1 | ||
PROTOCOL_DATA = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
Test the 'enum' module. | ||
""" | ||
|
||
# built-in | ||
from enum import IntEnum, auto | ||
|
||
# module under test | ||
from runtimepy.enum import RuntimeEnum | ||
|
||
|
||
class SampleEnum(IntEnum): | ||
"""A sample enumeration.""" | ||
|
||
A = auto() | ||
B = auto() | ||
C = auto() | ||
|
||
|
||
def test_runtime_enum_from_enum(): | ||
"""Test that we can create a runtime enumeration from a class.""" | ||
|
||
enum = RuntimeEnum.from_enum(SampleEnum, 1) | ||
assert enum.get_int("a") | ||
assert enum.get_int("b") | ||
assert enum.get_int("c") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
Test the 'telemetry' module. | ||
""" | ||
|
||
# module under test | ||
from runtimepy.enum.registry import EnumRegistry | ||
from runtimepy.telemetry import MessageType | ||
|
||
|
||
def test_message_type_basic(): | ||
"""Test basic interactions with the message-type enumeration.""" | ||
|
||
enum = MessageType.runtime_enum(1) | ||
assert enum.get_int("protocol_meta") == 1 | ||
assert enum.get_int("protocol_data") == 2 | ||
|
||
enum_reg = EnumRegistry({}) | ||
enum = MessageType.register_enum(enum_reg) | ||
assert enum_reg["MessageType"] is enum | ||
assert enum.get_int("protocol_meta") == 1 | ||
assert enum.get_int("protocol_data") == 2 |