def test_estimate_compression(self): with config.fake_proxy(): i = Image("http://radioprimetime.org/specials/focusspecials/images/dog2.jpg") self.assertAlmostEquals(i.estimate_compression(), 0.528500932546) i = Image("http://www.costumedogs.com/wp-content/uploads/2007/07/tux.jpg") self.assertAlmostEquals(i.estimate_compression(), 0.989372469636) i = Image("http://www.freefoto.com/images/01/07/01_07_1---Pair-of-Dogs_web.jpg?&k=Pair+of+Dogs") self.assertAlmostEquals(i.estimate_compression(), 0.268289197942)
def test_estimate_compression(self): with config.fake_proxy(): i = Image( 'http://radioprimetime.org/specials/focusspecials/images/dog2.jpg' ) self.assertAlmostEquals(i.estimate_compression(), 0.528500932546) i = Image( 'http://www.costumedogs.com/wp-content/uploads/2007/07/tux.jpg' ) self.assertAlmostEquals(i.estimate_compression(), 0.989372469636) i = Image( 'http://www.freefoto.com/images/01/07/01_07_1---Pair-of-Dogs_web.jpg?&k=Pair+of+Dogs' ) self.assertAlmostEquals(i.estimate_compression(), 0.268289197942)
def setUp(self): self.p = config.fake_proxy() self.p.activate()
def test_entropy(self): with config.fake_proxy(): i = Image('http://www.cs.unc.edu/~karl/me.jpg') self.assertAlmostEquals(i.entropy(), 8.67911685935) i = Image(config.fake_server('images/test_ocr.jpg')) self.assertAlmostEquals(i.entropy(), 5.2323108617)
def test_url(self): with config.fake_proxy(): i = Image('http://www.cs.unc.edu/~karl/me.jpg') self.assertEquals(i.url(), Url('http://www.cs.unc.edu/~karl/me.jpg'))
def test_from_file(self): with config.fake_proxy(): i1 = Image.from_file('test/person.jpg') i2 = Image('http://www.cs.unc.edu/~karl/me.jpg') self.assertEquals(i1.area(), i2.area())
def test_entropy(self): with config.fake_proxy(): i = Image("http://www.cs.unc.edu/~karl/me.jpg") self.assertAlmostEquals(i.entropy(), 8.67911685935) i = Image(config.fake_server("images/test_ocr.jpg")) self.assertAlmostEquals(i.entropy(), 5.2323108617)
def test_url(self): with config.fake_proxy(): i = Image("http://www.cs.unc.edu/~karl/me.jpg") self.assertEquals(i.url(), Url("http://www.cs.unc.edu/~karl/me.jpg"))
def test_from_file(self): with config.fake_proxy(): i1 = Image.from_file("test/person.jpg") i2 = Image("http://www.cs.unc.edu/~karl/me.jpg") self.assertEquals(i1.area(), i2.area())