Exemplo n.º 1
0
 def test_get_image_random(self, base, num, mode, asurl, release):
     images = getRandomImages(num=num,
                              mode=mode,
                              as_url=asurl,
                              release=release)
     assert images is not None
     assert num == len(images)
     assert isinstance(images, list) is True
     assert base in images[0]
Exemplo n.º 2
0
 def test_get_images_download_local_fail(self):
     localpath = self._make_paths(self.mangaredux,
                                  mode='local',
                                  inputs=[self.new_plateifu])
     remotepath = self._make_paths(self.remoteredux,
                                   mode='remote',
                                   inputs=[self.new_plateifu])
     self.assertFalse(os.path.isfile(localpath[0]))
     errmsg = 'Download not available when in local mode'
     with warnings.catch_warnings(record=True) as cm:
         warnings.simplefilter("always")
         image = getRandomImages(mode='local', as_url=True, download=True)
     self.assertIs(cm[-1].category, MarvinUserWarning)
     self.assertIn(errmsg, str(cm[-1].message))
Exemplo n.º 3
0
 def test_failures(self, mode, errmsg, release):
     with pytest.raises(AssertionError) as cm:
         image = getRandomImages(mode=mode, release=release)
     assert cm.type == AssertionError
     assert errmsg in str(cm.value)
Exemplo n.º 4
0
 def _get_image_random(self, basedir, num=10, mode=None, as_url=None):
     images = getRandomImages(num=num, mode=mode, as_url=as_url)
     self.assertIn(basedir, images[0])
     self.assertIsInstance(images, list)
     self.assertIsNotNone(images)
     self.assertEqual(num, len(images))
Exemplo n.º 5
0
 def test_notvalid_mode(self):
     errmsg = 'Mode must be either auto, local, or remote'
     with self.assertRaises(AssertionError) as cm:
         image = getRandomImages(mode='notvalidmode')
     self.assertIn(errmsg, str(cm.exception))