@@ -109,13 +109,17 @@ def test_put_vector_string_dtype():
109
109
[- 10 , 30.5 , - 30.5 , 40.508472 ], # longitudes
110
110
[10 , - 30.50 , 30.5 , - 40.508472 ], # latitudes
111
111
# datetimes
112
- ["2021-02-03" , "2021-02-03T04" , "2021-02-03T04:05:06.700" , "T04:50:06.700" ],
112
+ [
113
+ "2021-02-03T00:00:00" ,
114
+ "2021-02-03T04:00:00" ,
115
+ "2021-02-03T04:05:06" ,
116
+ "2021-03-02T04:50:06" ,
117
+ ],
113
118
]
114
119
115
120
expected_dtypes = [np .double , np .double , np .double , np .str_ ]
116
121
117
- for i , j in itertools .combinations_with_replacement (range (3 ), r = 2 ):
118
- # TODO: Change range(3) to range(4)
122
+ for i , j in itertools .combinations_with_replacement (range (4 ), r = 2 ):
119
123
with clib .Session () as lib :
120
124
dataset = lib .create_data (
121
125
family = "GMT_IS_DATASET|GMT_VIA_VECTOR" ,
@@ -138,12 +142,17 @@ def test_put_vector_string_dtype():
138
142
dataset ,
139
143
)
140
144
# Load the data and check that it's correct
141
- newx , newy = tmp_file .loadtxt (
142
- unpack = True ,
143
- dtype = [("x" , expected_dtypes [i ]), ("y" , expected_dtypes [j ])],
145
+ output = np .genfromtxt (
146
+ tmp_file .name , dtype = None , names = ("x" , "y" ), encoding = None
144
147
)
145
- npt .assert_allclose (newx , expected_vectors [i ])
146
- npt .assert_allclose (newy , expected_vectors [j ])
148
+ if i != 3 :
149
+ npt .assert_allclose (output ["x" ], expected_vectors [i ])
150
+ else :
151
+ npt .assert_array_equal (output ["x" ], expected_vectors [i ])
152
+ if j != 3 :
153
+ npt .assert_allclose (output ["y" ], expected_vectors [j ])
154
+ else :
155
+ npt .assert_array_equal (output ["y" ], expected_vectors [j ])
147
156
148
157
149
158
def test_put_vector_invalid_dtype ():
0 commit comments