Skip to content

Commit

Permalink
Fixes from unit test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nonprofittechy committed Aug 9, 2024
1 parent 5790b90 commit 5e7d52f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions docassemble/AssemblyLine/al_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,17 +1588,17 @@ def pronoun(self, **kwargs) -> str:
else:
default = self.name_full()

if hasattr(self, "pronouns"):
if hasattr(self, "pronouns") and self.pronouns:
if isinstance(self.pronouns, str):
pronouns = DADict(elements={self.pronouns.lower(): True})
else:
pronouns = self.pronouns

if self == this_thread.global_vars.user:
output = word("you", **kwargs)
elif hasattr(self, "pronouns"):
elif hasattr(self, "pronouns") and self.pronouns:
pronouns_to_use = []
if isinstance(pronouns, DADict):
pronouns_to_use = []
for pronoun in pronouns.true_values():
if pronoun in [
"she/her/hers",
Expand Down Expand Up @@ -1696,9 +1696,9 @@ def pronoun_possessive(self, target, **kwargs) -> str:
"thirdperson" not in kwargs or not kwargs["thirdperson"]
):
output = your(target, **kwargs)
elif hasattr(self, "pronouns"):
if isinstance(pronouns, DADict):
pronouns_to_use = []
elif hasattr(self, "pronouns") and self.pronouns:
pronouns_to_use = []
if isinstance(pronouns, DADict):
for pronoun in pronouns.true_values():
if pronoun in [
"she/her/hers",
Expand Down Expand Up @@ -1773,17 +1773,17 @@ def pronoun_subjective(self, **kwargs) -> str:
else:
default = self.name_full()

if hasattr(self, "pronouns"):
if hasattr(self, "pronouns") and self.pronouns:
if isinstance(self.pronouns, str):
pronouns = DADict(elements={self.pronouns.lower(): True})
else:
pronouns = self.pronouns

if self == this_thread.global_vars.user:
output = word("you", **kwargs)
elif hasattr(self, "pronouns"):
elif hasattr(self, "pronouns") and self.pronouns:
pronouns_to_use = []
if isinstance(pronouns, DADict):
pronouns_to_use = []
for pronoun in pronouns.true_values():
if pronoun in [
"she/her/hers",
Expand Down
6 changes: 3 additions & 3 deletions docassemble/AssemblyLine/test_al_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def setUp(self):
# Assigning this_thread to self.individual
self.individual.this_thread = self.this_thread

self.individual.name.first = "John"

def test_phone_numbers(self):
self.assertEqual(self.individual.phone_numbers(), "")
self.individual.phone_number = ""
Expand Down Expand Up @@ -423,9 +425,7 @@ def test_custom_pronouns(self):
self.assertEqual(self.individual.pronoun_possessive("fish"), "xem fish")

self.individual.pronouns_self_described = "Xe/Xir/Xirs/xem/xirself"
# Should raise an exception
with self.assertRaises(DAAttributeError):
self.individual.pronoun_objective()
self.assertEqual(self.individual.pronoun_objective(), "John")

def test_name_methods(self):
self.individual.name.first = "John"
Expand Down

0 comments on commit 5e7d52f

Please sign in to comment.