@@ -53,73 +53,100 @@ class ColorImage:
53
53
54
54
# test functions
55
55
def test_xaxis_attr () -> None :
56
- item = next (iter (xaxis_model .attr .values ()))
57
- assert item .name == "units"
58
- assert item .value == "pixel"
59
- assert item .type == "builtins.str"
56
+ units = xaxis_model .attrs [0 ]
57
+ assert units .name == "units"
58
+ assert units .tag == "attr"
59
+ assert units .type is str
60
+ assert units .value == "pixel"
61
+ assert units .cast == False
60
62
61
63
62
64
def test_xaxis_data () -> None :
63
- item = next (iter (xaxis_model .data .values ()))
64
- assert item .name == "data"
65
- assert item .type == {"dims" : ("x" ,), "dtype" : "int" }
66
- assert item .factory is None
65
+ data = xaxis_model .data_vars [0 ]
66
+ assert data .name == "data"
67
+ assert data .tag == "data"
68
+ assert data .dims == ("x" ,)
69
+ assert data .dtype == "int"
70
+ assert data .base is None
71
+ assert data .cast == True
67
72
68
73
69
74
def test_yaxis_attr () -> None :
70
- item = next (iter (yaxis_model .attr .values ()))
71
- assert item .name == "units"
72
- assert item .value == "pixel"
73
- assert item .type == "builtins.str"
75
+ units = yaxis_model .attrs [0 ]
76
+ assert units .name == "units"
77
+ assert units .tag == "attr"
78
+ assert units .type is str
79
+ assert units .value == "pixel"
80
+ assert units .cast == False
74
81
75
82
76
83
def test_yaxis_data () -> None :
77
- item = next (iter (yaxis_model .data .values ()))
78
- assert item .name == "data"
79
- assert item .type == {"dims" : ("y" ,), "dtype" : "int" }
80
- assert item .factory is None
84
+ data = yaxis_model .data_vars [0 ]
85
+ assert data .name == "data"
86
+ assert data .tag == "data"
87
+ assert data .dims == ("y" ,)
88
+ assert data .dtype == "int"
89
+ assert data .base is None
90
+ assert data .cast == True
81
91
82
92
83
93
def test_image_coord () -> None :
84
- items = iter (image_model .coord .values ())
85
-
86
- item = next (items )
87
- assert item .name == "mask"
88
- assert item .type == {"dims" : ("x" , "y" ), "dtype" : "bool" }
89
- assert item .factory is None
90
-
91
- item = next (items )
92
- assert item .name == "x"
93
- assert item .type == {"dims" : ("x" ,), "dtype" : "int" }
94
- assert item .factory is XAxis
95
-
96
- item = next (items )
97
- assert item .name == "y"
98
- assert item .type == {"dims" : ("y" ,), "dtype" : "int" }
99
- assert item .factory is YAxis
94
+ mask = image_model .coords [0 ]
95
+ assert mask .name == "mask"
96
+ assert mask .tag == "coord"
97
+ assert mask .dims == ("x" , "y" )
98
+ assert mask .dtype == "bool"
99
+ assert mask .base is None
100
+ assert mask .cast == True
101
+
102
+ x = image_model .coords [1 ]
103
+ assert x .name == "x"
104
+ assert x .tag == "coord"
105
+ assert x .dims == ("x" ,)
106
+ assert x .dtype == "int"
107
+ assert x .base is XAxis
108
+ assert x .cast == True
109
+
110
+ y = image_model .coords [2 ]
111
+ assert y .name == "y"
112
+ assert y .tag == "coord"
113
+ assert y .dims == ("y" ,)
114
+ assert y .dtype == "int"
115
+ assert y .base is YAxis
116
+ assert y .cast == True
100
117
101
118
102
119
def test_image_data () -> None :
103
- item = next (iter (image_model .data .values ()))
104
- assert item .name == "data"
105
- assert item .type == {"dims" : ("x" , "y" ), "dtype" : "float" }
106
- assert item .factory is None
120
+ data = image_model .data_vars [0 ]
121
+ assert data .name == "data"
122
+ assert data .tag == "data"
123
+ assert data .dims == ("x" , "y" )
124
+ assert data .dtype == "float"
125
+ assert data .base is None
126
+ assert data .cast == True
107
127
108
128
109
129
def test_color_data () -> None :
110
- items = iter (color_model .data .values ())
111
-
112
- item = next (items )
113
- assert item .name == "red"
114
- assert item .type == {"dims" : ("x" , "y" ), "dtype" : "float" }
115
- assert item .factory is Image
116
-
117
- item = next (items )
118
- assert item .name == "green"
119
- assert item .type == {"dims" : ("x" , "y" ), "dtype" : "float" }
120
- assert item .factory is Image
121
-
122
- item = next (items )
123
- assert item .name == "blue"
124
- assert item .type == {"dims" : ("x" , "y" ), "dtype" : "float" }
125
- assert item .factory is Image
130
+ red = color_model .data_vars [0 ]
131
+ assert red .name == "red"
132
+ assert red .tag == "data"
133
+ assert red .dims == ("x" , "y" )
134
+ assert red .dtype == "float"
135
+ assert red .base is Image
136
+ assert red .cast == True
137
+
138
+ green = color_model .data_vars [1 ]
139
+ assert green .name == "green"
140
+ assert green .tag == "data"
141
+ assert green .dims == ("x" , "y" )
142
+ assert green .dtype == "float"
143
+ assert green .base is Image
144
+ assert green .cast == True
145
+
146
+ blue = color_model .data_vars [2 ]
147
+ assert blue .name == "blue"
148
+ assert blue .tag == "data"
149
+ assert blue .dims == ("x" , "y" )
150
+ assert blue .dtype == "float"
151
+ assert blue .base is Image
152
+ assert blue .cast == True
0 commit comments