Skip to content

Commit

Permalink
fix: aliases on their own used to end in .
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Oct 4, 2022
1 parent 6c46b66 commit 48d785e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pango_aliasor/aliasor.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def partial_compress(self, name, up_to: int = 0, accepted_aliases: set = {}):
alias = self.realias_dict[to_alias]
return alias + "." + ".".join(name_split[(3 * level + 1) :])

if name_split[(3 * up_to + 1) :] == []:
return alias
return alias + "." + ".".join(name_split[(3 * up_to + 1) :])


Expand Down
1 change: 1 addition & 0 deletions tests/test_aliasor.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def test_partial_alias_accepted():
assert aliasor.partial_compress('B.1.1.529.1.2', accepted_aliases={"BA","AZ"}) == "BA.1.2"
assert aliasor.partial_compress('B.1.617.2.3', accepted_aliases={"BA","AZ"}) == "B.1.617.2.3"
assert aliasor.partial_compress('B.1.1.529.2.75.1.2', accepted_aliases={"BA"}) == 'BA.2.75.1.2'
assert aliasor.partial_compress('B', accepted_aliases={"BA"}) == 'B'

def test_partial_alias_combination():
aliasor = Aliasor()
Expand Down

0 comments on commit 48d785e

Please sign in to comment.