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

Method testParserPython06

tests/notebook/NotebookTest.cpp:134–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134void NotebookTest::testParserPython06() {
135 // Testing datetime ms
136 QString input = QStringLiteral("array(['2016-03-26T02:14:34.000', '2017-03-26T02:14:34.000', '2018-03-26T02:14:34.000'], dtype=datetime64[ms])");
137 VariableParser parser(QStringLiteral("python"), input);
138
139 QTEST_ASSERT(parser.dataType() == AbstractColumn::ColumnMode::DateTime);
140 QCOMPARE(parser.isParsed(), true);
141 auto res = parser.dateTime();
142
143 QCOMPARE(res.length(), 3);
144 QCOMPARE(res.at(0).isValid(), true);
145 QCOMPARE(res.at(1).isValid(), true);
146 QCOMPARE(res.at(2).isValid(), true);
147 QTEST_ASSERT(res.at(0).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2016-03-26T02:14:34.000"));
148 QTEST_ASSERT(res.at(1).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2017-03-26T02:14:34.000"));
149 QTEST_ASSERT(res.at(2).toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")) == QStringLiteral("2018-03-26T02:14:34.000"));
150}
151
152void NotebookTest::testParserPython07() {
153 // Testing datetime s

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