generated from funnyzak/pyproject-starter
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest_d2_style.py
67 lines (49 loc) · 1.45 KB
/
test_d2_style.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
from py_d2.style import D2Style
def test_d2_style():
style = D2Style()
assert str(style) == ""
def test_d2_style_fill():
style = D2Style(fill="red")
assert str(style) == "style: {\n fill: red\n}"
def test_d2_style_stroke():
style = D2Style(stroke="red")
assert str(style) == "style: {\n stroke: red\n}"
def test_d2_style_stroke_width():
style = D2Style(stroke_width=2)
assert str(style) == "style: {\n stroke-width: 2\n}"
def test_d2_style_shadow():
style = D2Style(shadow=True)
assert str(style) == "style: {\n shadow: true\n}"
def test_d2_style_opacity():
style = D2Style(opacity=0.5)
assert str(style) == "style: {\n opacity: 0.5\n}"
def test_d2_style_stroke_dash():
style = D2Style(stroke_dash=2)
assert str(style) == "style: {\n stroke-dash: 2\n}"
def test_d2_style_three_d():
style = D2Style(three_d=True)
assert str(style) == "style: {\n 3d: true\n}"
def test_d2_style_all():
style = D2Style(
stroke="red",
stroke_width=2,
fill="red",
shadow=True,
opacity=0.5,
stroke_dash=2,
three_d=True,
)
assert str(style) == "\n".join(
[
"style: {",
" stroke: red",
" stroke-width: 2",
" fill: red",
" shadow: true",
" opacity: 0.5",
" stroke-dash: 2",
" 3d: true",
"}",
]
)