Skip to content

Commit 9dd27a0

Browse files
committed
Adding mock tests for uncovered lines
1 parent b8b58d7 commit 9dd27a0

2 files changed

Lines changed: 402 additions & 629 deletions

File tree

mssql_python/pybind/ddbc_bindings.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ py::object get_time_class();
6060
}
6161

6262
inline py::object ParseSqlTimeTextToPythonObject(const char* timeText, SQLLEN timeTextLen) {
63-
if (!timeText || timeTextLen <= 0) {
63+
if (!timeText || (timeTextLen <= 0 && timeTextLen != SQL_NO_TOTAL)) {
6464
return py::none();
6565
}
6666

@@ -4538,6 +4538,12 @@ PYBIND11_MODULE(ddbc_bindings, m) {
45384538
// Expose architecture-specific constants
45394539
m.attr("ARCHITECTURE") = ARCHITECTURE;
45404540

4541+
// Test helper: expose time-text parser for unit testing edge cases
4542+
m.def("_test_parse_time_text", &ParseSqlTimeTextToPythonObject,
4543+
"Parse a SQL TIME/TIME2 text buffer into a Python datetime.time object (test helper)",
4544+
py::arg("timeText"), py::arg("timeTextLen"));
4545+
m.attr("SQL_NO_TOTAL") = static_cast<int>(SQL_NO_TOTAL);
4546+
45414547
// Expose the C++ functions to Python
45424548
m.def("ThrowStdException", &ThrowStdException);
45434549
m.def("GetDriverPathCpp", &GetDriverPathCpp, "Get the path to the ODBC driver");

0 commit comments

Comments
 (0)