def test_totally_invalid(self): with pytest.raises(ConversionError): from_uri('not-a-valid-uri')
def test_invalid_type(self): with pytest.raises(ConversionError): from_uri('spotify:invalid:b62')
def test_invalid_prefix(self): with pytest.raises(ConversionError): from_uri('youtube:track:b62')
def test_invalid_id(self): with pytest.raises(ConversionError): from_uri('spotify:track:n_b62')
def test_valid(self): t, i = from_uri('spotify:track:b62') assert t == 'track' and i == 'b62'
def test_user_non_b62(self): t, i = from_uri('spotify:user:a#a') assert t == 'user' and i == 'a#a'
def _call(uri, type_, id_) -> bool: t, i = from_uri(uri) return t == type_ and i == id_
def get_track_preview(self, uri): id = tekore.from_uri(uri)[1] return self.spotify_client.track(id).preview_url