Skip to content

Commit

Permalink
Add tests to Component creation
Browse files Browse the repository at this point in the history
Two additional if clauses were added in this PR but not covered by
existing tests.
  • Loading branch information
Zabamund committed Apr 16, 2021
1 parent 99bc129 commit 763e451
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
'colour': 'Grey',
'lithology': None}

r7 = {'coords': (123, 456)}

r8 = {'coords': (123, 456),
'None value': None}

def test_init():
"""Test Rock() for backward compatibility.
Expand Down Expand Up @@ -90,3 +94,17 @@ def test_from_text():
assert rock3 == rock4
rock5 = Component.from_text(s, lexicon, required='not there')
assert not rock5 # Should be None

def test_None():
"""
Test generation with None
"""
rock8 = Component(r8)
assert rock8 == Component({'coords': (123, 456)})

def test_tuple():
"""
Test generation from tuples
"""
rock7 = Component(r7)
assert rock7 == Component({'coords': (123, 456)})

0 comments on commit 763e451

Please sign in to comment.