class CrystalTestCase(unittest.TestCase): def setUp(self): self.crystal = Crystal({'a': 'T T G A C T C T C T T A A', 'b': Chain('G A G A G T C A'), 'c': 'T T G A C T C T C T T A A', 'd': Chain('G A G A G T C A') }) def testLen(self): self.assertEqual(len(self.crystal), len(self.crystal.data)) def testGetItem(self): self.assertEqual(self.crystal['a'], self.crystal.data['a']) def testSetItem(self): target = copy.deepcopy(self.crystal) e = 'MET ALA LEU THR ASN ALA GLN ILE LEU ALA VAL ILE ASP SER' f = 'LEU GLY GLY GLY LEU GLN GLY THR LEU HIS CYS TYR GLU ILE PRO LEU' target['e'] = e target['f'] = Chain(f) self.assertEqual(Chain(e), target['e']) self.assertEqual(Chain(f), target['f']) def testDelItem(self): target = copy.deepcopy(self.crystal) del target['b'] self.assertFalse('b' in target.data) self.assertTrue('a' in target.data) self.assertTrue('c' in target.data) def testClear(self): target = copy.deepcopy(self.crystal) target.clear() self.assertEqual(len(target.data), 0) def testKeys(self): self.assertEqual(list(self.crystal.keys()), list(self.crystal.data.keys())) def testValues(self): self.assertEqual(list(self.crystal.values()), list(self.crystal.data.values())) def testItems(self): self.assertEqual(list(self.crystal.items()), list(self.crystal.data.items())) def testKeys(self): self.assertEqual(list(self.crystal.keys()), list(self.crystal.data.keys())) def testHasKey(self): self.assertTrue('b' in self.crystal) self.assertTrue('c' in self.crystal) self.assertFalse('z' in self.crystal)
class CrystalTestCase(unittest.TestCase): def setUp(self): self.crystal = Crystal({ 'a' : 'T T G A C T C T C T T A A', 'b' : Chain('G A G A G T C A'), 'c' : 'T T G A C T C T C T T A A', 'd' : Chain('G A G A G T C A') }) def testLen(self): self.assertEqual(len(self.crystal), len(self.crystal.data)) def testGetItem(self): self.assertEqual(self.crystal[ 'a' ], self.crystal.data[ 'a' ]) def testSetItem(self): target = copy.deepcopy(self.crystal) e = 'MET ALA LEU THR ASN ALA GLN ILE LEU ALA VAL ILE ASP SER' f = 'LEU GLY GLY GLY LEU GLN GLY THR LEU HIS CYS TYR GLU ILE PRO LEU' target[ 'e' ] = e target[ 'f' ] = Chain(f) self.assertEqual(Chain(e), target[ 'e' ]) self.assertEqual(Chain(f), target[ 'f' ]) def testDelItem(self): target = copy.deepcopy(self.crystal) del target[ 'b' ] self.assertFalse('b' in target.data) self.assertTrue('a' in target.data) self.assertTrue('c' in target.data) def testClear(self): target = copy.deepcopy(self.crystal) target.clear() self.assertEqual(len(target.data), 0) def testKeys(self): self.assertEqual(list(self.crystal.keys()), list(self.crystal.data.keys())) def testValues(self): self.assertEqual(list(self.crystal.values()), list(self.crystal.data.values())) def testItems(self): self.assertEqual(list(self.crystal.items()), list(self.crystal.data.items())) def testKeys(self): self.assertEqual(list(self.crystal.keys()), list(self.crystal.data.keys())) def testHasKey(self): self.assertTrue('b' in self.crystal) self.assertTrue('c' in self.crystal) self.assertFalse('z' in self.crystal)
class CrystalTestCase(unittest.TestCase): def setUp(self): self.crystal = Crystal({ "a": "T T G A C T C T C T T A A", "b": Chain("G A G A G T C A"), "c": "T T G A C T C T C T T A A", "d": Chain("G A G A G T C A") }) def testLen(self): self.assertEqual(len(self.crystal), len(self.crystal.data)) def testGetItem(self): self.assertEqual(self.crystal["a"], self.crystal.data["a"]) def testSetItem(self): target = copy.deepcopy(self.crystal) e = "MET ALA LEU THR ASN ALA GLN ILE LEU ALA VAL ILE ASP SER" f = "LEU GLY GLY GLY LEU GLN GLY THR LEU HIS CYS TYR GLU ILE PRO LEU" target["e"] = e target["f"] = Chain(f) self.assertEqual(Chain(e), target["e"]) self.assertEqual(Chain(f), target["f"]) def testDelItem(self): target = copy.deepcopy(self.crystal) del target["b"] self.assertFalse("b" in target.data) self.assertIn("a", target.data) self.assertIn("c", target.data) def testClear(self): target = copy.deepcopy(self.crystal) target.clear() self.assertEqual(len(target.data), 0) def testKeys(self): self.assertEqual(list(self.crystal.keys()), list(self.crystal.data.keys())) def testValues(self): self.assertEqual(list(self.crystal.values()), list(self.crystal.data.values())) def testItems(self): self.assertEqual(list(self.crystal.items()), list(self.crystal.data.items())) def testHasKey(self): self.assertIn("b", self.crystal) self.assertIn("c", self.crystal) self.assertFalse("z" in self.crystal)