Skip to content

Commit

Permalink
Created some simple tests of teh description to get started.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsaxe committed Jun 18, 2020
1 parent 238b41e commit 8e97eae
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/test_supercell_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,59 @@

import pytest # noqa: F401
import supercell_step # noqa: F401
import re


@pytest.fixture
def instance():
instance = supercell_step.Supercell()
instance._id = (1,)
return instance


def test_construction():
"""Simplest test that we can make a SUPERCELL object"""
instance = supercell_step.Supercell()
assert (
str(type(instance)) == "<class 'supercell_step.supercell.Supercell'>"
)


def test_version():
"""Test that the object returns a version"""
instance = supercell_step.Supercell()
result = instance.version
assert isinstance(result, str) and len(result) > 0


def test_git_revision():
"""Test that the object returns a git revision"""
instance = supercell_step.Supercell()
result = instance.git_revision
assert isinstance(result, str) and len(result) > 0


def test_description_text_default(instance):
"""Test the default description text"""

assert re.fullmatch(
(
r'Step 1: Supercell [-+.0-9a-z]+\n'
r' Create a 2 x 2 x 2 supercell from the current cell'
), instance.description_text()
) is not None


def test_description_text_expr_expr(instance):
"""Test the default description text"""

assert re.fullmatch(
(
r'Step 1: Supercell [-+.0-9a-z]+\n'
r' Create a 5 x 4 x 3 supercell from the current cell'
), instance.description_text({
'na': 5,
'nb': 4,
'nc': 3,
})
) is not None

0 comments on commit 8e97eae

Please sign in to comment.