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

Method testParserPython07

tests/notebook/NotebookTest.cpp:152–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void NotebookTest::testParserPython07() {
153 // Testing datetime s
154 QString input = QStringLiteral("array(['2016-03-26T02:14:34', '2017-03-26T02:14:34', '2018-03-26T02:14:34'], dtype=datetime64[s])");
155 VariableParser parser(QStringLiteral("python"), input);
156
157 QTEST_ASSERT(parser.dataType() == AbstractColumn::ColumnMode::DateTime);
158 QCOMPARE(parser.isParsed(), true);
159 auto res = parser.dateTime();
160
161 QCOMPARE(res.length(), 3);
162 QCOMPARE(res.at(0).isValid(), true);
163 QCOMPARE(res.at(1).isValid(), true);
164 QCOMPARE(res.at(2).isValid(), true);
165 QTEST_ASSERT(res.at(0).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2016-03-26T02:14:34.000"));
166 QTEST_ASSERT(res.at(1).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2017-03-26T02:14:34.000"));
167 QTEST_ASSERT(res.at(2).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2018-03-26T02:14:34.000"));
168}
169
170void NotebookTest::testParserPython08() {
171 // Testing minute 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