def test_singleton(self): self.assertTrue(M.dummy() is M.dummy()) self.assertTrue(M.dummy('a') is M.dummy('a')) self.assertTrue(M.dummy('a') is not M.dummy('b')) self.assertTrue(M.dummy('a') is not M.unknown('a')) self.assertTrue(M.dummy('C') is not M.element('C')) self.assertTrue(M.element('C') is M.element('C'))
def test_type(self): self.assertEqual(M.dummy().type, "dummy") self.assertEqual(M.unknown().type, "") self.assertEqual(M.element('O').type, "element") self.assertEqual(M.cgparticle('ala').type, "cgparticle")
def test_atom_descriptor(self): self.assertRaises(TypeError, lambda: M.dummy(42)) self.assertRaises(ValueError, lambda: M.element(42)) self.assertRaises(ValueError, lambda: M.element("X"))