Esempio n. 1
0
 def testArtistRef(self):
   # test if 2 calls to the same artist return the same reference
   Factories.clear()
   artist = ArtistFactory.get(self.artist)
   artist.test = self.artist_test
   artist2 = ArtistFactory.get(self.artist)
   self.assertEqual(artist.test, artist2.test)
Esempio n. 2
0
  def testArtistClear(self):
    Factories.clear()
    artist = ArtistFactory.get(self.artist)
    artist.test = self.artist_test

    Factories.clear()
    artist = ArtistFactory.get(self.artist)
    self.assertEqual(artist.test, None)
Esempio n. 3
0
 def testArtistRelationRef(self):
   # test if 2 calls to the same artist return the same reference
   Factories.clear()
   artistA = ArtistFactory.get(self.artistA)
   artistB = ArtistFactory.get(self.artistB)
   artist_relationA = ArtistRelationFactory.get(artistA, artistB)
   artist_relationA.test = self.artist_relation_test
   artist_relationB = ArtistRelationFactory.get(artistA, artistB)
   self.assertEqual(artist_relationA.test, artist_relationB.test)
Esempio n. 4
0
  def testArtistPickle(self):
    Factories.clear()
    artist = ArtistFactory.get(self.artist)
    artist.test = self.artist_test
    state = pickle.dumps(Factories.getstate())

    Factories.clear()
    pickle.loads(state)
    artist = ArtistFactory.get(self.artist)

    self.assertEqual(artist.test, self.artist_test)
Esempio n. 5
0
 def testArtistRelation(self):
   Factories.clear()
   artistA = ArtistFactory.get(self.artistA)
   artistA.test = self.artistA_test
   artistB = ArtistFactory.get(self.artistB)
   artistB.test = self.artistB_test
   artist_relation = ArtistRelationFactory.get(artistA, artistB)
   artist_relation.test = self.artist_relation_test
   self.assertEqual(artist_relation.artistA.test, self.artistA_test)
   self.assertEqual(artist_relation.artistB.test, self.artistB_test)
   self.assertEqual(artist_relation.test, self.artist_relation_test)
Esempio n. 6
0
  def testArtistRelationPickle(self):
    Factories.clear()
    artistA = ArtistFactory.get(self.artistA)
    artistB = ArtistFactory.get(self.artistB)
    artist_relation = ArtistRelationFactory.get(artistA, artistB)
    artist_relation.test = self.artist_relation_test

    state = pickle.dumps(Factories.getstate())
    Factories.clear()
    pickle.loads(state)

    artistA = ArtistFactory.get(self.artistA)
    artistB = ArtistFactory.get(self.artistB)
    artist_relation = ArtistRelationFactory.get(artistA, artistB)
    artist_relation.test = self.artist_relation_test
    self.assertEqual(artist_relation.test, self.artist_relation_test)
Esempio n. 7
0
 def testArtist(self):
   Factories.clear()
   artist = ArtistFactory.get(self.artist)
   artist.test = self.artist_test
   self.assertEqual(artist.name, self.artist)
   self.assertEqual(artist.test, self.artist_test)
Esempio n. 8
0
File: track.py Progetto: pscn/ads
 def __init__(self, artist_name, track_title):
   self.artist = ArtistFactory.get(artist_name)
   self.title = track_title
   self.ratingref = RatingFactory.get(0.6, 0.1)
   self.rating = self.ratingref.rating