Skip to content

Commit

Permalink
update unit test to fix failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Nov 13, 2018
1 parent a09d49c commit 5c12938
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
10 changes: 8 additions & 2 deletions _unittests/ut_plotting/test_plot_gallery.py
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
"""
@brief test log(time=4s)
@brief test log(time=6s)
"""

import sys
import os
import unittest
import warnings
import http.client
import numpy
from pyquickhelper.loghelper import noLOG
from pyquickhelper.pycode import ExtTestCase, get_temp_folder
Expand Down Expand Up @@ -69,7 +71,11 @@ def test_plot_gallery_url(self):
root + 'cat-2947188__480.jpg']

temp = get_temp_folder(__file__, "temp_plot_gallery_url")
fig, _ = plot_gallery_images(files, return_figure=True)
try:
fig, _ = plot_gallery_images(files, return_figure=True)
except http.client.RemoteDisconnected as e:
warnings.warn("Unable to fetch image {0}'".format(e))
return
img = os.path.join(temp, "gallery.png")
fig.savefig(img)
plt.close('all')
Expand Down
15 changes: 4 additions & 11 deletions _unittests/ut_search_rank/test_search_vectors.py
Expand Up @@ -8,7 +8,7 @@
import unittest
import pandas
import numpy
from pyquickhelper.loghelper import fLOG
from sklearn.linear_model import LogisticRegression
from pyquickhelper.pycode import ExtTestCase, get_temp_folder

try:
Expand All @@ -29,12 +29,10 @@

class TestSearchVectors(ExtTestCase):

def test_search_vectors(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
def test_import(self):
self.assertTrue(LogisticRegression is not None)

def test_search_vectors(self):
res = []
for i in range(20):
h = i * 0.05
Expand Down Expand Up @@ -93,11 +91,6 @@ def test_search_vectors(self):
self.assertTrue(meta is None)

def test_search_vectors_zip(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")

temp = get_temp_folder(__file__, "temp_search_vectors_zip")

res = []
Expand Down

0 comments on commit 5c12938

Please sign in to comment.