Skip to content

Commit 00e4c56

Browse files
committed
feat: include version in full name of TopicList and add corresponding test
1 parent c4f96f4 commit 00e4c56

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

openproficiency/TopicList.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ def timestamp(self, value: Union[str, datetime, None]) -> None:
113113

114114
@property
115115
def full_name(self) -> str:
116-
"""Get the full name of the TopicList in 'owner/name' format."""
117-
return f"{self.owner}/{self.name}"
116+
"""Get the full name of the TopicList in 'owner/name@version' format."""
117+
full_name = f"{self.owner}/{self.name}"
118+
if self.version:
119+
full_name += f"@{self.version}"
120+
return full_name
118121

119122
# Debugging
120123
def __repr__(self) -> str:

tests/TopicList_test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,24 @@ def test_full_name(self):
220220
# Assert
221221
assert full_name == "example.com/example-topic-list"
222222

223+
def test_full_name_with_version(self):
224+
"""Test getting the full name of the topic list, including version."""
225+
226+
# Arrange
227+
owner = "example.com"
228+
name = "example-topic-list"
229+
topic_list = TopicList(
230+
owner=owner,
231+
name=name,
232+
version="1.2.3",
233+
)
234+
235+
# Act
236+
full_name = topic_list.full_name
237+
238+
# Assert
239+
assert full_name == "example.com/example-topic-list@1.2.3"
240+
223241
def test_version_setter_valid_format(self):
224242
"""Test setting version with valid semantic versioning."""
225243

0 commit comments

Comments
 (0)