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

Method testParserPython10

tests/notebook/NotebookTest.cpp:212–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void NotebookTest::testParserPython10() {
213 // Testing datetime day
214 QString input = QStringLiteral("array(['2016-03-26', '2017-03-26', '2018-03-26'], dtype=datetime64[D])");
215 VariableParser parser(QStringLiteral("python"), input);
216
217 QTEST_ASSERT(parser.dataType() == AbstractColumn::ColumnMode::DateTime);
218 QCOMPARE(parser.isParsed(), true);
219 auto res = parser.dateTime();
220
221 QCOMPARE(res.length(), 3);
222 QCOMPARE(res.at(0).isValid(), true);
223 QCOMPARE(res.at(1).isValid(), true);
224 QCOMPARE(res.at(2).isValid(), true);
225 QTEST_ASSERT(res.at(0).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2016-03-26T00:00:00.000"));
226 QTEST_ASSERT(res.at(1).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2017-03-26T00:00:00.000"));
227 QTEST_ASSERT(res.at(2).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2018-03-26T00:00:00.000"));
228}
229
230void NotebookTest::testParserDateTime64ns() {
231 // 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