def test_str_has_both(self): namespace, identifier = n(), n() node = Abundance(namespace=namespace, identifier=identifier) self.assertEqual( 'a({namespace}:{identifier})'.format(namespace=namespace, identifier=ensure_quotes(identifier)), node.as_bel(), )
def test_str_has_identifier(self): namespace, identifier = n(), n() node = Abundance(namespace=namespace, identifier=identifier) self.assertEqual( 'a({namespace}:{identifier})'.format(namespace=namespace, identifier=identifier), node.as_bel())
def test_abundance_as_bel(self): """Test converting an abundance to BEL with a name that does not need quotation.""" namespace, name = 'HGNC', 'YFG' node = Abundance(namespace=namespace, name=name) self.assertEqual('a(HGNC:YFG)', node.as_bel())
def test_abundance_as_bel_quoted(self): """Test converting an abundance to BEL with a name that needs quotation.""" namespace, name = 'HGNC', 'YFG-1' node = Abundance(namespace=namespace, name=name) self.assertEqual('a(HGNC:"YFG-1")', node.as_bel())
def test_as_tuple(self): namespace, name = n(), n() node = Abundance(namespace=namespace, name=name) self.assertEqual(hash(node), hash(node.as_bel()))
def test_abundance_as_no_quotes(self): """Test converting an abundance that doesn't need quotes, but looks crazy.""" namespace, name = 'a-c', 'd.e.f' node = Abundance(namespace=namespace, name=name) self.assertEqual('a(a-c:d.e.f)', node.as_bel())