Files
DicePlayer/tests/environment/test_system.py

25 lines
597 B
Python

from diceplayer.environment import Molecule, System
import unittest
class TestSystem(unittest.TestCase):
def test_class_instantiation(self):
system = System()
self.assertIsInstance(system, System)
def test_add_type(self):
system = System()
system.add_type(Molecule("test"))
self.assertIsInstance(system.molecule, list)
with self.assertRaises(TypeError) as ex:
system.add_type("test")
self.assertEqual(ex.exception, "Error: molecule is not a Molecule instance")
if __name__ == "__main__":
unittest.main()