Ejemplo n.º 1
0
  def test_format(self):
    contig = EMBLContig()
    header_mock = MagicMock()
    feature_mock_1 = MagicMock()
    feature_mock_2 = MagicMock()
    sequence_mock = MagicMock()
    header_mock.format.return_value = "Header\n"
    feature_mock_1.format.return_value = "Feature 1\n"
    feature_mock_1.start = 0
    feature_mock_2.format.return_value = "Feature 2\n"
    feature_mock_2.start = 100
    sequence_mock.format.return_value = "Sequence\n"
    contig.header = header_mock
    contig.features = {1: feature_mock_1, 2: feature_mock_2}
    contig.sequence = sequence_mock
    calculated_string = contig.format()
    expected_string = """\
Header
Feature 1
Feature 2
Sequence
"""
    self.assertEqual(calculated_string, expected_string)
Ejemplo n.º 2
0
 def test_format_no_features(self):
   contig = EMBLContig()
   contig.header = self.create_blank_bit_of_contig()
   contig.sequence = self.create_blank_bit_of_contig()
   self.assertEquals(contig.format(), '')