<commit_before>from django.test import TestCase

# Create your tests here.
<commit_msg>Add unit tests for artists.models<commit_after>import datetime

from unittest import TestCase

from . import models


class ArtistModelTest(TestCase):

    """Tests for Artist model."""

    def test_str(self):
        name = "<NAME>"
        artist = models.Artist(name=name)
        self.assertEqual(str(artist), name)


class HyperlinkModelTest(TestCase):

    """Tests for Hyperlink model."""

    def test_str(self):
        url = "http://example.com"
        link = models.Hyperlink(order=1, name="Jamendo", url=url)
        self.assertEqual(str(link), url)


class JamendoArtist(TestCase):

    """Tests for Jamendo artist model."""

    def setUp(self):
        self.name = "<NAME>"
        self.url = "http://www.jamendo.com/artist/1333"
        self.artist = models.JamendoArtist(
            id=1333,
            name=self.name,
            image="https://imgjam.com/artists/b/bradsucks.jpg",
            shorturl="http://jamen.do/a/1333",
            joindate=datetime.date(2006, 2, 27),
            shareurl=self.url,
            website="http://www.bradsucks.net/"
        )

    def test_str(self):
        self.assertEqual(str(self.artist), self.name)

    def test_name(self):
        self.assertEqual(self.artist.name, self.name)

    def test_url(self):
        self.assertEqual(self.artist.url, self.url)


class MagnatuneArtist(TestCase):

    """Tests for Magnatune artist model."""

    def setUp(self):
        self.name = "<NAME>"
        self.url = "http://magnatune.com/artists/brad_sucks/"
        self.artist = models.MagnatuneArtist(
            id=685,
            artist=self.name,
            homepage='brad_sucks',
            description='brilliantly sardonic indie rock',
            bio="One of Magnatune's best selling artists.",
            bandphoto='/artists/img/brad_sucks2.jpg',
            city='',
            state='Ontario',
            country='Canada',
        )

    def test_str(self):
        self.assertEqual(str(self.artist), self.name)

    def test_name(self):
        self.assertEqual(self.artist.name, self.name)

    def test_url(self):
        self.assertEqual(self.artist.url, self.url)


class FMAArtist(TestCase):

    """Tests for FreeMusicArchive artist model."""

    def setUp(self):
        self.name = "<NAME>"
        self.url = "http://freemusicarchive.org/music/Brad_Sucks/"
        self.artist = models.FMAArtist(
            artist_id=3227,
            artist_name=self.name,
            artist_handle="Brad_Sucks",
            artist_bio="<NAME> is a musician from Ottawa.",
            artist_comments=0,
            artist_date_created=datetime.datetime(2009, 5, 5, 7, 25, 25),
            artist_donation_url="http://www.bradsucks.net/tips/",
            artist_favorites=20,
            artist_image_file="http://freemusicarchive.org/file/images/"
                              "artists/Brad_Sucks_-_20110330163911796.jpg",
            artist_url=self.url,
            artist_website="http://www.bradsucks.net/",
            tags=["brad sucks"],
        )

    def test_str(self):
        self.assertEqual(str(self.artist), self.name)

    def test_name(self):
        self.assertEqual(self.artist.name, self.name)

    def test_url(self):
        self.assertEqual(self.artist.url, self.url)

{'fraction_non_alphanumeric': 0.12983918999404406, 'fraction_numerical': 0.01756998213222156, 'mean_word_length': 2.2931372549019606, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 1, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1966953', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1045, 'n_words': 182}