From 48253c24b0fd568e7d1639e7742b5fa20c969a4e Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Tue, 13 Apr 2021 11:26:38 +0100 Subject: [PATCH] pytest: Separate text tests --- server/camcops_server/cc_modules/cc_text.py | 13 ------ .../cc_modules/tests/cc_text_tests.py | 44 +++++++++++++++++++ 2 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 server/camcops_server/cc_modules/tests/cc_text_tests.py diff --git a/server/camcops_server/cc_modules/cc_text.py b/server/camcops_server/cc_modules/cc_text.py index 0739ecc39..4198afabd 100644 --- a/server/camcops_server/cc_modules/cc_text.py +++ b/server/camcops_server/cc_modules/cc_text.py @@ -31,7 +31,6 @@ from enum import auto, Enum, unique from typing import TYPE_CHECKING -from camcops_server.cc_modules.cc_unittest import DemoRequestTestCase from pendulum import Date if TYPE_CHECKING: @@ -297,15 +296,3 @@ def server_string(req: "CamcopsRequest", w: SS) -> str: return _("Yes") raise ValueError("Bad value passed to server_string") - - -class TextUnitTest(DemoRequestTestCase): - """ - Unit tests. - """ - def test_server_string(self) -> None: - for k in SS.__dict__.keys(): - if k.startswith("_"): - continue - w = SS[k] - assert isinstance(server_string(self.req, w), str) diff --git a/server/camcops_server/cc_modules/tests/cc_text_tests.py b/server/camcops_server/cc_modules/tests/cc_text_tests.py new file mode 100644 index 000000000..43e6b65b8 --- /dev/null +++ b/server/camcops_server/cc_modules/tests/cc_text_tests.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +""" +camcops_server/cc_modules/cc_text.py + +=============================================================================== + + Copyright (C) 2012-2020 Rudolf Cardinal (rudolf@pobox.com). + + 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 . + +=============================================================================== + +**Text used by the server, and translated.** + +""" + +from camcops_server.cc_modules.cc_text import server_string, SS +from camcops_server.cc_modules.cc_unittest import DemoRequestTestCase + + +class TextTestCase(DemoRequestTestCase): + """ + Unit tests. + """ + def test_server_string(self) -> None: + for k in SS.__dict__.keys(): + if k.startswith("_"): + continue + w = SS[k] + assert isinstance(server_string(self.req, w), str)