コード例 #1
0
	def testConstructor(self):
		m1 = proj1.Movie()
		m2 = proj1.Movie("The Chorus", "Christophe Barratier", 2005, "https://www.example-url-chorus.com", "PG-13", 5700000)

		self.assertEqual(m1.rating, "No Rating")
		self.assertEqual(m1.movie_length, 0)
		self.assertEqual(m2.title, "The Chorus")
		self.assertEqual(m2.author, "Christophe Barratier")
		self.assertEqual(m2.release_year, 2005)
		self.assertEqual(m2.url, "https://www.example-url-chorus.com")
		self.assertEqual(m2.rating,"PG-13")
		self.assertEqual(m2.movie_length, 5700000)
		self.assertRaises(AttributeError, lambda: m2.album)
		self.assertRaises(AttributeError, lambda: m2.genre)
		self.assertRaises(AttributeError, lambda: m2.track_length)
コード例 #2
0
ファイル: proj1_w20_test.py プロジェクト: gnenadov/507proj1
    def testInfo(self):
        m2 = proj1.Movie("The Chorus", "Christophe Barratier", 2005,
                         "https://www.example-url-chorus.com", "PG-13",
                         5700000)

        self.assertEqual(m2.info(),
                         "The Chorus by Christophe Barratier (2005) [PG-13]")
コード例 #3
0
	def testMovie(self):
		f = open("sample_json.json","r")
		sample_data = json.loads(f.read())
		f.close()
		
		m = proj1.Movie(json=sample_data[0])
		
		self.assertEqual(m.title, "Jaws")
		self.assertEqual(m.author, "Steven Spielberg")
		self.assertEqual(m.release_year, "1975")
		self.assertEqual(m.url, "https://itunes.apple.com/us/movie/jaws/id526768967?uo=4")
		self.assertEqual(m.rating, "PG")
		self.assertEqual(m.movie_length, 7451455)
		self.assertEqual(m.info(), "Jaws by Steven Spielberg (1975) [PG]")
		self.assertEqual(m.length(), 124)
コード例 #4
0
ファイル: proj1_w20_test.py プロジェクト: gnenadov/507proj1
    def testLength(self):
        m2 = proj1.Movie("The Chorus", "Christophe Barratier", 2005,
                         "https://www.example-url-chorus.com", "PG-13",
                         5700000)

        self.assertEqual(m2.length(), 95)