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)
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)
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)
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)
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)
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)
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)
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