Skip to content

Commit

Permalink
Drop unmatched square bracket in Allegiance str method
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberiaResurrection committed Nov 8, 2023
1 parent 28e09ee commit 576c15a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions PyRoute/Galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def set_wiki_name(name, code, base):
names[1] = names[1].strip()
if '' == names[0]:
raise ValueError("First part of name string must not be an empty string itself")
if '' == names[1]:
if '' == names[1] and ',' in name:
raise ValueError("Second part of name string must not be an empty string itself")

if code.startswith('Na'):
Expand All @@ -144,7 +144,7 @@ def set_wiki_name(name, code, base):
return '[[{}]]'.format(name)

def __str__(self):
return '{} ([{})'.format(self.name, self.code)
return '{} ({})'.format(self.name, self.code)

def is_unclaimed(self):
return AllyGen.is_unclaimed(self)
Expand Down
5 changes: 5 additions & 0 deletions Tests/Hypothesis/testAllegiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ def test_set_wiki_name(self, name, code, base):
assume(wiki_name is not None)
self.assertNotIn('[]', wiki_name, "Empty square brackets not allowed in wiki name")

def test_string_representation(self):
alg = Allegiance("Test", "Test Allegiance Plz Ignore")

expected = 'Test Allegiance Plz Ignore (Test)'
self.assertEqual(expected, str(alg), "Unexpected string representation")

if __name__ == '__main__':
unittest.main()

0 comments on commit 576c15a

Please sign in to comment.