15.2.171. camcops_server.cc_modules.cc_testproviders

camcops_server/cc_modules/cc_testproviders.py


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/>.


Faker test data providers.

There may be some interest in a Faker Medical community provider if we felt it was worth the effort.

https://github.com/joke2k/faker/issues/1142

See also duplicate functionality in CRATE: crate_anon/testing/providers.py

class camcops_server.cc_modules.cc_testproviders.ConsistentDateOfBirthProvider(generator)[source]

Faker date_of_birth calculates from the current time so gives different results on different days.

class camcops_server.cc_modules.cc_testproviders.ForenameProvider(generator)[source]

Return a forename given the sex of the person

class camcops_server.cc_modules.cc_testproviders.SexProvider(generator)[source]

Return a random sex, with realistic distribution.

class camcops_server.cc_modules.cc_testproviders.ValidPhoneNumberProvider(generator)[source]

Return a random mobile phone number

class camcops_server.cc_modules.cc_testproviders.WaistProvider(generator)[source]

Return a random waist circumference in centimetres