Kentaro Wada 8 лет назад
Родитель
Сommit
f78c053e52
2 измененных файлов с 21 добавлено и 1 удалено
  1. 2 1
      .travis.yml
  2. 19 0
      tests/test_utils.py

+ 2 - 1
.travis.yml

@@ -21,4 +21,5 @@ install:
   - sudo -H python setup.py install
 
 script:
-  - true
+  - sudo -H pip install nose
+  - nosetests tests

+ 19 - 0
tests/test_utils.py

@@ -0,0 +1,19 @@
+import json
+import os.path as osp
+
+import nose
+import numpy as np
+
+from labelme import utils
+
+
+here = osp.dirname(osp.abspath(__file__))
+
+
+def test_img_b64_to_array():
+    json_file = osp.join(here, '../_static/IMG_6319.json')
+    data = json.load(open(json_file))
+    img_b64 = data['imageData']
+    img = utils.img_b64_to_array(img_b64)
+    nose.tools.assert_equal(img.dtype, np.uint8)
+    nose.tools.assert_equal(img.shape, (3024, 4032, 3))