def test_Product_From_Sortable_Challenge(self): """ Tests the first Listing entry from the sortable challenge, namely: "title":"Fujifilm FinePix REAL 3D W3 10 MP Digital Camera\ with Dual 3x Optical Zoom Lenses (Black)", "manufacturer":"Fujifilm Canada", "currency":"CAD", "price":"499.99" We test if the Listing is correctly initiated, if all the getters work properly, the string representation is right and the JSON representation is right. """ title = "Fujifilm FinePix REAL 3D W3 10 MP Digital Camera\ with Dual 3x Optical Zoom Lenses (Black)" manufacturer = "Fujifilm Canada" currency = "CAD" price = "499.99" stringRep = """Title: Fujifilm FinePix REAL 3D W3 10 MP Digital Camera\ with Dual 3x Optical Zoom Lenses (Black) Manufacturer: Fujifilm Canada Currency: CAD Price: 499.99""" jsonRep = """{"title":"Fujifilm FinePix REAL 3D W3 10 MP Digital Camera with Dual 3x Optical Zoom Lenses (Black)","manufacturer":"Fujifilm Canada","currency":"CAD","price":"499.99"}""" try: testListing = Listing(title,manufacturer,currency,price) except: self.fail("Could not instanciate valid Listing") self.assertEqual(title,testListing.getTitle(), "The title was not stored properly") self.assertEqual(manufacturer,testListing.getManufacturer(), "The manufacturer was not stored properly") self.assertEqual(currency,testListing.getCurrency(), "The Currency was not stored properly") self.assertEqual(price,testListing.getPrice(), "The price was not stored properly") self.assertEqual(stringRep, str(testListing), "The string representation was not correct") self.assertEqual(json.loads(jsonRep),json.loads(testListing.toJSON()), "The JSON representation was not correct")