def test_wrap_with_space_at_80(self): source_attributes = {"organism": 'abc', "db_xref": "taxon:5678", "note": "chromX"} feature = EMBLFeature('source', 1, 1234, '+', source_attributes) formatted_product = feature.product_attribute_formatter('product','Permease for cytosine/purines, uracil, thiamine, allantoin') expected_product = 'FT /product="Permease for cytosine/purines, uracil, thiamine,\n' + \ 'FT allantoin"'
def test_no_wrap_at_length_80(self): source_attributes = {"organism": 'abc', "db_xref": "taxon:5678", "note": "chromX"} feature = EMBLFeature('source', 1, 1234, '+', source_attributes) formatted_product = feature.product_attribute_formatter('product','1,4-dihydroxy-2-naphthoate octaprenyltransferase') expected_product = 'FT /product="1,4-dihydroxy-2-naphthoate octaprenyltransferase"' assert len(expected_product) == 80 self.assertEqual(formatted_product, expected_product)
def test_no_wrap_at_length_79(self): source_attributes = {"organism": 'abc', "db_xref": "taxon:5678", "note": "chromX"} feature = EMBLFeature('source', 1, 1234, '+', source_attributes) formatted_product = feature.product_attribute_formatter('product','Anthranilate 1,2-dioxygenase ferredoxin subunit') expected_product = 'FT /product="Anthranilate 1,2-dioxygenase ferredoxin subunit"' assert len(expected_product) == 79 self.assertEqual(formatted_product, expected_product)
def test_initializer_for_ignored_features(self): feature = EMBLFeature( feature_type='ncRNA', start = 100, end = 200, strand = '+', feature_attributes = {'some_attribute': 'ABC' } ) self.assertEqual(feature.format(), None)
def test_split_product_attribute_on_hyphen(self): source_attributes = {"organism": 'abc', "db_xref": "taxon:5678", "note": "chromX"} feature = EMBLFeature('source', 1, 1234, '+', source_attributes) # TODO: This test currently 'passes' but shows the undesirable # behaviour of splitting up a long word. formatted_product = feature.product_attribute_formatter('product','2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate synthase') expected_product = 'FT /product="2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxy\n' + \ 'FT late synthase"' self.assertEqual(formatted_product, expected_product)
def test_split_product_attribute_on_hyphen(self): source_attributes = {"organism": 'abc', "db_xref": "taxon:5678", "note": "chromX"} feature = EMBLFeature('source', 1, 1234, '+', source_attributes) formatted_product = feature.product_attribute_formatter('product','2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate synthase') expected_product = """\ FT /product="2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carbox FT ylate synthase" """ self.assertEqual(formatted_product, expected_product)
def create_uninitialized_feature(self): # In most cases I don't want tests to run the __init__ # This creates an otherwise identical EMBLFeature object return EMBLFeature.__new__(EMBLFeature)