提交 826b8a12 编写于 作者: HansBug's avatar HansBug 😆

dev(hansbug): fix this version

上级 4891ef3c
......@@ -42,7 +42,7 @@ test-command = [
archs = ["x86_64", "aarch64"] # Build for x86_64 and arm64
skip = ["pp* *musllinux*"] # dependencies do not build for musl
before-test = [# Unittest for linux
"apt-get install -y graphviz",
"yum install -y graphviz",
"pip install -r {project}/requirements-test.txt",
]
test-command = [
......
......@@ -9,20 +9,13 @@ import pytest
from click.testing import CliRunner
from hbutils.testing import cmdv, OS
from treevalue import FastTreeValue, dump, graphics
from treevalue import FastTreeValue, dump
from treevalue.entry.cli import treevalue_cli
t1 = FastTreeValue({'a': 1, 'b': 2, 'x': {'c': 3, 'd': 4}})
t2 = FastTreeValue({'a': 1, 'b': {2, 4}, 'x': {'c': [1, 3], 'd': 4}})
t3 = FastTreeValue({'a': 1, 'b': 2, 'x': {'c': t2.b, 'd': t2.x.c}})
g = graphics(
(t1, 't1'), (t2, 't2'), (t3, 't3'),
title='This is title for g.',
cfg=dict(bgcolor='#ffffff00'),
dup_value=(list,),
)
@pytest.mark.unittest
class TestEntryCliGraph:
......@@ -43,6 +36,7 @@ class TestEntryCliGraph:
assert os.path.exists('test_graph.gv')
assert os.path.getsize('test_graph.gv') <= 2500
@unittest.skipUnless(cmdv('dot'), 'Dot installed only')
def test_simple_code_graph_to_stdout(self):
runner = CliRunner()
with runner.isolated_filesystem():
......@@ -198,6 +192,7 @@ class TestEntryCliGraph:
assert 'first title' not in content
assert 'This is title for g.' in content
@unittest.skipUnless(cmdv('dot'), 'Dot installed only')
def test_cfg(self):
runner = CliRunner()
with runner.isolated_filesystem():
......
import unittest
from functools import reduce
from operator import __mul__
from typing import Type
import numpy as np
import pytest
from hbutils.testing import cmdv
from treevalue.tree import func_treelize, TreeValue, raw, mapping, delayed, FastTreeValue
from ..tree.base import get_treevalue_test
......@@ -606,6 +608,7 @@ def get_fasttreevalue_test(treevalue_class: Type[FastTreeValue]):
assert t2.x.c is not t.x.c
assert t2.x.d is not t.x.d
@unittest.skipUnless(cmdv('dot'), 'Dot installed only')
def test_graph(self):
t = treevalue_class({
'a': [4, 3, 2, 1],
......@@ -619,6 +622,7 @@ def get_fasttreevalue_test(treevalue_class: Type[FastTreeValue]):
graph = t.graph('t')
assert len(graph.source) <= 2290
@unittest.skipUnless(cmdv('dot'), 'Dot installed only')
def test_graphics(self):
t = treevalue_class({
'a': [4, 3, 2, 1],
......
......@@ -23,7 +23,7 @@ class TestTreeTreeIntegration:
'a': np.random.randint(0, 10, (2, 3)),
'b': {
'x': np.asarray(233.0),
'y': np.random.randn(2, 3)
'y': np.random.randn(2, 3) + 1,
}
})
r1 = double(t1)
......@@ -40,7 +40,7 @@ class TestTreeTreeIntegration:
'a': np.random.randint(0, 10, (2, 3)),
'b': {
'x': np.asarray(233.0),
'y': np.random.randn(2, 3)
'y': np.random.randn(2, 3) + 1,
}
})
r2 = double(t2)
......
import pickle
import re
import unittest
from typing import Type
import pytest
from hbutils.testing import OS
from hbutils.testing import OS, cmdv
from test.tree.tree.test_constraint import GreaterThanConstraint
from treevalue import raw, TreeValue, delayed, ValidationError
......@@ -750,6 +751,7 @@ def get_treevalue_test(treevalue_class: Type[TreeValue]):
assert newt1 == t1
assert newt1.constraint == t1.constraint
@unittest.skipUnless(cmdv('dot'), 'Dot installed only')
def test_repr_svg(self):
t1 = get_demo_constraint_tree()
assert hasattr(t1, '_repr_svg_')
......@@ -758,6 +760,7 @@ def get_treevalue_test(treevalue_class: Type[TreeValue]):
assert isinstance(_repr_svg_, str)
assert 4500 <= len(_repr_svg_) <= 4900
@unittest.skipUnless(cmdv('dot'), 'Dot installed only')
def test_repr_png(self):
t1 = get_demo_constraint_tree()
assert hasattr(t1, '_repr_png_')
......@@ -769,6 +772,7 @@ def get_treevalue_test(treevalue_class: Type[TreeValue]):
else:
assert 16050 <= len(_repr_png_) <= 20500
@unittest.skipUnless(cmdv('dot'), 'Dot installed only')
def test_repr_jpeg(self):
t1 = get_demo_constraint_tree()
assert hasattr(t1, '_repr_jpeg_')
......
import unittest
import numpy as np
import pytest
from hbutils.testing import cmdv
from treevalue import FastTreeValue, graphics
......@@ -10,6 +13,7 @@ class MyFastTreeValue(FastTreeValue):
@pytest.mark.unittest
class TestTreeTreeGraph:
@unittest.skipUnless(cmdv('dot'), 'Dot installed only')
def test_graphics(self):
t = MyFastTreeValue({
'a': [4, 3, 2, 1],
......
import unittest
from shutil import which
from unittest.mock import patch
import pytest
from hbutils.testing import cmdv
from treevalue.utils import build_graph
......@@ -20,6 +22,7 @@ def no_dot():
@pytest.mark.unittest
class TestUtilsTree:
@unittest.skipUnless(cmdv('dot'), 'Dot installed only')
def test_build_graph(self):
t = {'a': 1, 'b': 2, 'x': {'c': 3, 'd': 4}}
g = build_graph((t, 't'), graph_title="Demo of build_graph.")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册