15.2.445. camcops_server.tasks.tests.core10_tests


Copyright (C) 2012, University of Cambridge, Department of Psychiatry. Created by Rudolf Cardinal (rnc1001@cam.ac.uk).

This file is part of CamCOPS.

CamCOPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

CamCOPS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with CamCOPS. If not, see <https://www.gnu.org/licenses/>.

class camcops_server.tasks.tests.core10_tests.Core10ReportDateRangeTests(*args, **kwargs)[source]

Test code:

-- 2019-10-21
-- For SQLite:

    (_pk INT, patient_id INT, when_created DATETIME, _current INT);

.schema core10


SELECT * from core10;

SELECT STRFTIME('%Y-%m-%d %H:%M:%f', core10.when_created) from core10;
-- ... gives e.g.
-- 2018-06-01 00:00:00.000

    FROM core10
    WHERE core10._current = 1
    AND STRFTIME('%Y-%m-%d %H:%M:%f', core10.when_created) >= '2018-06-01 00:00:00.000000'
    AND STRFTIME('%Y-%m-%d %H:%M:%f', core10.when_created) < '2018-09-01 00:00:00.000000';

-- That fails. Either our date/time comparison code is wrong for SQLite, or
-- we are inserting text in the wrong format.
-- Ah. It's the number of decimal places:

SELECT '2018-06-01 00:00:00.000' >= '2018-06-01 00:00:00.000000';  -- 0, false
SELECT '2018-06-01 00:00:00.000' >= '2018-06-01 00:00:00.000';  -- 1, true

See camcops_server.cc_modules.cc_sqla_coltypes.isotzdatetime_to_utcdatetime_sqlite().

class camcops_server.tasks.tests.core10_tests.Core10ReportDoubleCountingTests(*args, **kwargs)[source]
class camcops_server.tasks.tests.core10_tests.Core10ReportEmptyTests(*args, **kwargs)[source]
class camcops_server.tasks.tests.core10_tests.Core10ReportTestCase(*args, **kwargs)[source]
class camcops_server.tasks.tests.core10_tests.Core10ReportTests(*args, **kwargs)[source]