Skip to content

Commit

Permalink
More test assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
veghp committed Sep 24, 2020
1 parent 2c2c334 commit 25035cf
Showing 1 changed file with 37 additions and 25 deletions.
62 changes: 37 additions & 25 deletions tests/test_caravagene.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@


def test_part():
part_instance = Part("promoter", label="my promoter")
part_instance.style
Part.from_dict(
{
"category": "promoter",
Expand All @@ -16,9 +14,15 @@ def test_part():
}
)

part_instance = Part("promoter", label="my promoter")
assert part_instance.category == "promoter"
assert part_instance.label == "my promoter"
assert part_instance.reversed is False
assert part_instance.style


def test_construct():
construct_from_dict = Construct.from_dict(
Construct.from_dict(
{
"parts": [
{
Expand Down Expand Up @@ -47,32 +51,33 @@ def test_construct():
)
assert construct.name == "Test construct"
assert construct.note == "Test note"
assert len(construct.parts) == 4


def test_constructlist(tmpdir):
constructs_from_dict = {
"constructs": [
{
"parts": [
{
"category": "promoter",
"label": "my promoter",
"subscript": "p12",
"reversed": False,
"sublabel": "lorem ipsum",
"bg_color": "none",
}
],
"name": "Test construct",
"note": "Test note",
}
]
}

constructs_from_spreadsheet = ConstructList(
os.path.join("tests", "from_spreadsheet.xlsx")
ConstructList.from_dict(
{
"constructs": [
{
"parts": [
{
"category": "promoter",
"label": "my promoter",
"subscript": "p12",
"reversed": False,
"sublabel": "lorem ipsum",
"bg_color": "none",
}
],
"name": "Test construct",
"note": "Test note",
}
]
}
)

ConstructList(os.path.join("tests", "from_spreadsheet.xlsx"))

constructs = ConstructList(
[
Construct(
Expand All @@ -83,9 +88,16 @@ def test_constructlist(tmpdir):
Part("insulator", label="I1"),
]
)
]
],
note="This is a note",
)

assert constructs.note == "This is a note"
assert constructs.orientation == "portrait"
assert constructs.page_size == "A4"
assert constructs.size == 13
assert constructs.width == 600

constructs.to_image(os.path.join(str(tmpdir), "construct.jpeg"))
constructs.to_html(os.path.join(str(tmpdir), "construct.html"))
# This won't run on a headless server (Travis CI) but can be tested locally:
Expand Down

0 comments on commit 25035cf

Please sign in to comment.