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

Method testParserPython08

tests/notebook/NotebookTest.cpp:170–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170void NotebookTest::testParserPython08() {
171 // Testing minute datetime
172 QString input = QStringLiteral("array(['2016-03-26T02:14', '2017-03-26T02:14', '2018-03-26T02:14'], dtype=datetime64[m])");
173 VariableParser parser(QStringLiteral("python"), input);
174
175 QTEST_ASSERT(parser.dataType() == AbstractColumn::ColumnMode::DateTime);
176 QCOMPARE(parser.isParsed(), true);
177 auto res = parser.dateTime();
178
179 QCOMPARE(res.length(), 3);
180 QCOMPARE(res.at(0).isValid(), true);
181 QCOMPARE(res.at(1).isValid(), true);
182 QCOMPARE(res.at(2).isValid(), true);
183 QVERIFY2(res.at(0).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2016-03-26T02:14:00.000"),
184 qPrintable(res.at(0).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"))));
185 QVERIFY2(res.at(1).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2017-03-26T02:14:00.000"),
186 qPrintable(res.at(1).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"))));
187 QVERIFY2(res.at(2).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2018-03-26T02:14:00.000"),
188 qPrintable(res.at(2).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"))));
189}
190
191void NotebookTest::testParserPython09() {
192 // Testing hour datetime

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