def test_Source(self): from clld.db.models.common import Source d = Source(id='abc') self.assertIsNone(d.gbs_identifier) d = Source(id='abc', jsondata={'gbs': {'volumeInfo': {}}}) self.assertIsNone(d.gbs_identifier) d = Source( id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{'type': 'x', 'identifier': 'y'}]}}}) self.assertEquals(d.gbs_identifier, 'y') d = Source( id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{'type': 'ISBN_10', 'identifier': ''}]}}}) self.assertEquals(d.gbs_identifier, 'ISBN:') d = Source( id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{'type': 'ISBN_13', 'identifier': ''}]}}}) self.assertEquals(d.gbs_identifier, 'ISBN:') d.bibtex()
def test_Source(): from clld.db.models.common import Source d = Source(id='abc') assert d.gbs_identifier is None d = Source(id='abc', jsondata={'gbs': {'volumeInfo': {}}}) assert d.gbs_identifier is None d = Source( id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{'type': 'x', 'identifier': 'y'}]}}}) assert d.gbs_identifier == 'y' d = Source( id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{'type': 'ISBN_10', 'identifier': ''}]}}}) assert d.gbs_identifier == 'ISBN:' d = Source( id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{'type': 'ISBN_13', 'identifier': ''}]}}}) assert d.gbs_identifier == 'ISBN:' d.bibtex()
def test_Source(self): from clld.db.models.common import Source d = Source(id='abc') self.assertIsNone(d.gbs_identifier) d = Source(id='abc', jsondata={'gbs': {'volumeInfo': {}}}) self.assertIsNone(d.gbs_identifier) d = Source(id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{ 'type': 'x', 'identifier': 'y' }] } } }) self.assertEquals(d.gbs_identifier, 'y') d = Source(id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{ 'type': 'ISBN_10', 'identifier': '' }] } } }) self.assertEquals(d.gbs_identifier, 'ISBN:') d = Source(id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{ 'type': 'ISBN_13', 'identifier': '' }] } } }) self.assertEquals(d.gbs_identifier, 'ISBN:') d.bibtex()
def test_Source(): from clld.db.models.common import Source d = Source(id='abc') assert d.gbs_identifier is None d = Source(id='abc', jsondata={'gbs': {'volumeInfo': {}}}) assert d.gbs_identifier is None d = Source(id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{ 'type': 'x', 'identifier': 'y' }] } } }) assert d.gbs_identifier == 'y' d = Source(id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{ 'type': 'ISBN_10', 'identifier': '' }] } } }) assert d.gbs_identifier == 'ISBN:' d = Source(id='abc', jsondata={ 'gbs': { 'volumeInfo': { 'industryIdentifiers': [{ 'type': 'ISBN_13', 'identifier': '' }] } } }) assert d.gbs_identifier == 'ISBN:' d.bibtex()