Skip to content

Commit

Permalink
Added aastex.Affiliation class.
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie committed Oct 27, 2023
1 parent 70672d7 commit c7a026e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions aastex/_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

__all__ = [
"Title",
"Affiliation",
]


Expand All @@ -12,3 +13,14 @@ class Title(pylatex.base_classes.LatexObject):

def dumps(self):
return pylatex.Command("title", self.name).dumps()


@dataclasses.dataclass
class Affiliation(pylatex.base_classes.LatexObject):
"""Organization that an author is associated with"""

name: str
"""human-readable name of the organization"""

def dumps(self):
return pylatex.Command('affiliation', self.name).dumps()
14 changes: 14 additions & 0 deletions aastex/_tests/test_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ def test_name(self, a: aastex.Title):

def test_dumps(self, a: aastex.Title):
assert isinstance(a.dumps(), str)


@pytest.mark.parametrize(
argnames="a",
argvalues=[
aastex.Affiliation("Fancy University"),
],
)
class TestAffiliation:
def test_name(self, a: aastex.Affiliation):
assert isinstance(a.name, str)

def test_dumps(self, a: aastex.Affiliation):
assert isinstance(a.dumps(), str)

0 comments on commit c7a026e

Please sign in to comment.