MCPcopy Create free account
hub / github.com/KDE/labplot / testParserPython09

Method testParserPython09

tests/notebook/NotebookTest.cpp:191–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191void NotebookTest::testParserPython09() {
192 // Testing hour datetime
193 QString input = QStringLiteral("array(['2016-03-26T02', '2017-03-26T02', '2018-03-26T02'], dtype=datetime64[h])");
194 VariableParser parser(QStringLiteral("python"), input);
195
196 QTEST_ASSERT(parser.dataType() == AbstractColumn::ColumnMode::DateTime);
197 QCOMPARE(parser.isParsed(), true);
198 auto res = parser.dateTime();
199
200 QCOMPARE(res.length(), 3);
201 QCOMPARE(res.at(0).isValid(), true);
202 QCOMPARE(res.at(1).isValid(), true);
203 QCOMPARE(res.at(2).isValid(), true);
204 QVERIFY2(res.at(0).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2016-03-26T02:00:00.000"),
205 qPrintable(res.at(0).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"))));
206 QVERIFY2(res.at(1).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2017-03-26T02:00:00.000"),
207 qPrintable(res.at(1).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"))));
208 QVERIFY2(res.at(2).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2018-03-26T02:00:00.000"),
209 qPrintable(res.at(2).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"))));
210}
211
212void NotebookTest::testParserPython10() {
213 // Testing datetime day

Callers

nothing calls this directly

Calls 6

isParsedMethod · 0.80
lengthMethod · 0.80
dataTypeMethod · 0.45
dateTimeMethod · 0.45
isValidMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected