Skip to content

Commit 3a007cf

Browse files
Pull in changes from up-core-api 1.5.7 (#21)
* 1.5.7 Changes * Add Notification UMessageType * Add isShortForm() * Various Fixes * 100% Code Coverage * Fix UTC ref, streamline multimethod --------- Co-authored-by: Matthew D'Alonzo <[email protected]> Co-authored-by: Neelam Kushwah <[email protected]>
1 parent dd74f4c commit 3a007cf

File tree

57 files changed

+5445
-2097
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+5445
-2097
lines changed

pyproject.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "up-python"
3-
version = "0.1.1-dev"
3+
version = "0.1.2-dev"
44
description = "Language specific uProtocol library for building and using UUri, UUID, UAttributes, UTransport, and more."
55
authors = ["Neelam Kushwah <[email protected]>"]
66
license = "The Apache License, Version 2.0"
@@ -15,13 +15,11 @@ packages = [{ include = "uprotocol" },
1515
[tool.poetry.dependencies]
1616
python = "^3.8"
1717
cloudevents = "*"
18-
multipledispatch = "*"
18+
multimethod = "*"
1919
gitpython = ">=3.1.41"
2020
googleapis-common-protos = ">=1.56.4"
21+
protobuf = "4.24.2"
2122

2223
[build-system]
2324
requires = ["poetry-core"]
24-
build-backend = "poetry.core.masonry.api"
25-
26-
27-
25+
build-backend = "poetry.core.masonry.api"

scripts/pull_and_compile_protos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
REPO_URL = "https://github.com/eclipse-uprotocol/up-core-api.git"
3636
PROTO_REPO_DIR = os.path.abspath("../target")
37-
TAG_NAME = "uprotocol-core-api-1.5.6"
37+
TAG_NAME = "uprotocol-core-api-1.5.7"
3838
PROTO_OUTPUT_DIR = os.path.abspath("../uprotocol/proto")
3939

4040

@@ -44,7 +44,7 @@ def clone_or_pull(repo_url, PROTO_REPO_DIR):
4444
print(f"Repository cloned successfully from {repo_url} to {PROTO_REPO_DIR}")
4545
# Checkout the specific tag
4646
repo.git.checkout(TAG_NAME)
47-
except git.exc.GitCommandError as clone_error:
47+
except git.exc.GitCommandError:
4848
try:
4949
git_pull_command = ["git", "pull", "origin", TAG_NAME]
5050
subprocess.run(git_pull_command, cwd=PROTO_REPO_DIR, check=True)

tests/test_cloudevent/test_datamodel/test_ucloudevent.py

Lines changed: 252 additions & 91 deletions
Large diffs are not rendered by default.

tests/test_cloudevent/test_datamodel/test_ucloudeventattributes.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,23 @@ def test_to_string(self):
4141
expected = "UCloudEventAttributes{hash='somehash', priority=UPRIORITY_CS1, ttl=3, token='someOAuthToken'}"
4242
self.assertEqual(expected, str(u_cloud_event_attributes))
4343

44+
def test_create_valid_with_blank_traceparent(self):
45+
u_cloud_event_attributes = UCloudEventAttributesBuilder().with_hash("somehash").with_priority(
46+
UPriority.UPRIORITY_CS1).with_ttl(3).with_token("someOAuthToken").with_traceparent(" ").build()
47+
self.assertTrue(u_cloud_event_attributes.get_hash() is not None)
48+
self.assertEqual("somehash", u_cloud_event_attributes.get_hash())
49+
self.assertFalse(u_cloud_event_attributes.get_traceparent() is not None)
50+
51+
def test_create_empty_with_only_traceparent(self):
52+
u_cloud_event_attributes = UCloudEventAttributesBuilder().with_traceparent("someTraceParent").build()
53+
self.assertFalse(u_cloud_event_attributes.get_hash() is not None)
54+
self.assertFalse(u_cloud_event_attributes.get_priority() is not None)
55+
self.assertFalse(u_cloud_event_attributes.get_token() is not None)
56+
self.assertFalse(u_cloud_event_attributes.get_ttl() is not None)
57+
self.assertTrue(u_cloud_event_attributes.get_traceparent() is not None)
58+
self.assertFalse(u_cloud_event_attributes.is_empty())
59+
self.assertEqual("someTraceParent", u_cloud_event_attributes.get_traceparent())
60+
4461
def test_create_valid(self):
4562
u_cloud_event_attributes = UCloudEventAttributesBuilder().with_hash("somehash").with_priority(
4663
UPriority.UPRIORITY_CS6).with_ttl(3).with_token("someOAuthToken").build()

0 commit comments

Comments
 (0)