コード例 #1
0
 def setUp(self):
     en = Language(pk='en')
     self.john = Author(first_name="John", last_name="Lennon")
     self.john.save()
     self.song1 = Song(title="Give Peace a Chance",
                       composed_year=1971,
                       language=en)
     self.song1.save()
     self.song1.composed_by.add(self.john)
     self.john.songs_composed.create(title="Imagine",
                                     composed_year=1971,
                                     language=en)
コード例 #2
0
ファイル: tests.py プロジェクト: BackupTheBerlios/lino-svn
class TestCase(unittest.TestCase):
    
    def setUp(self):
        en = Language(pk='en')
        self.john=Author(first_name="John",last_name="Lennon")
        self.john.save()
        self.song1=Song(title="Give Peace a Chance",
          composed_year=1971,language=en)
        self.song1.save()
        self.song1.composed_by.add(self.john)
        self.john.songs_composed.create(title="Imagine",
          composed_year=1971,language=en)

    def test01(self):
        self.assertEquals(unicode(self.song1), 'Give Peace a Chance (1)')
        self.assertEquals(self.john.songs_composed.count(), 2)
        self.assertEquals(Song.objects.count(), 2)
コード例 #3
0
class TestCase(unittest.TestCase):
    def setUp(self):
        en = Language(pk='en')
        self.john = Author(first_name="John", last_name="Lennon")
        self.john.save()
        self.song1 = Song(title="Give Peace a Chance",
                          composed_year=1971,
                          language=en)
        self.song1.save()
        self.song1.composed_by.add(self.john)
        self.john.songs_composed.create(title="Imagine",
                                        composed_year=1971,
                                        language=en)

    def test01(self):
        self.assertEquals(unicode(self.song1), 'Give Peace a Chance (1)')
        self.assertEquals(self.john.songs_composed.count(), 2)
        self.assertEquals(Song.objects.count(), 2)
コード例 #4
0
ファイル: tests.py プロジェクト: BackupTheBerlios/lino-svn
 def setUp(self):
     en = Language(pk='en')
     self.john=Author(first_name="John",last_name="Lennon")
     self.john.save()
     self.song1=Song(title="Give Peace a Chance",
       composed_year=1971,language=en)
     self.song1.save()
     self.song1.composed_by.add(self.john)
     self.john.songs_composed.create(title="Imagine",
       composed_year=1971,language=en)