aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/db
AgeCommit message (Collapse)Author
2023-07-10Fix linting errors caused by bump to Python 3.10migrate-to-python3.10Frederick Muriuki Muriithi
2023-07-05Skip tests broken by Python-3.10 temporarilyFrederick Muriuki Muriithi
Skip the tests that have been broken by the migrations to Python-3.10 temporarily, until we can fix them.
2023-03-20Fix get_all_species testzsloan
2022-05-27Move sql for CRUD operations on case-attrs from gn2 to gn3BonfaceKilz
2022-05-27Move sql for modifying case-attributes from gn2 to gn3BonfaceKilz
2022-05-27Return all the results from CaseAttributes column as isBonfaceKilz
* gn3/db/sample_data.py: Remove "collections" import. Add "Optional" import. (get_case_attributes): Return the results of "fetchall" from the case attributes. * tests/unit/db/test_sample_data.py (test_get_case_attributes): Update failing test.
2022-05-26Add Endpoint to get menu items for use in UIFrederick Muriuki Muriithi
2022-04-12Test that a carriage return is removed when generating csvBonfaceKilz
* tests/unit/db/test_sample_data.py: import "get_trait_csv_sample_data". (test_get_trait_csv_sample_data): New test function.
2022-04-07Use case attribute id inside brackets if present during insertionsBonfaceKilz
* gn3/db/sample_data.py (delete_sample_data): If an id is present in the column header, use it. * tests/unit/db/test_sample_data.py (test_delete_sample_data): Update tests to capture the above.
2022-04-07Use case attribute id inside brackets if present during insertionsBonfaceKilz
* gn3/db/sample_data.py (insert_sample_data): If an id is present in the column header, use it. * tests/unit/db/test_sample_data.py (test_insert_sample_data): Update tests to capture the above.
2022-04-07Use case attribute id inside brackets if present during updatesBonfaceKilz
* gn3/db/sample_data.py: Import "parse_csv_column". (update_sample_data): If an id is present in the column header, use it. * tests/unit/db/test_sample_data.py (test_update_sample_data): Update tests to capture the above.
2022-04-07Add method for fetching the case_attributesBonfaceKilz
* gn3/db/sample_data.py (get_case_attributes): New function. * tests/unit/db/test_sample_data.py (test_get_case_attributes): Test case for the above.
2022-04-01Run python-black in fileBonfaceKilz
* gn3/csvcmp.py: Run "black -l 79 ..." * tests/unit/db/test_sample_data.py: Ditto. * tests/unit/test_csvcmp.py: Ditto.
2022-03-12Fix pylint errors in unit_testsBonfaceKilz
2022-03-12Append the strain name when extracting "actions"BonfaceKilz
* gn3/db/sample_data.py (__extract_actions): During updates, make sure that the strain name is part of the returned string when extracting "actions". * tests/unit/db/test_sample_data.py: Add test cases for the above.
2022-03-12Apply auto-pep8 to sample_data.py and it's test fileBonfaceKilz
2022-03-12Update how data is updated by re-using existing functionsBonfaceKilz
* gn3/db/sample_data.py (get_sample_data_ids): Re-use "delete_sample_data" and "insert_sample_data" when updating data; and also add logic for updating modified data. * tests/unit/db/test_sample_data.py: Add tests for the above.
2022-03-12Create action dict that's created when updating dataBonfaceKilz
* gn3/db/sample_data.py (__extract_actions): An update on a vector of data can contain: inserts, deletes and updates. This functions extracts these actions during an update. * tests/unit/db/test_sample_data.py (test_extract_actions): Add test-case for the above.
2022-03-12Add test cases for inserting and deleting dataBonfaceKilz
* tests/unit/db/test_sample_data.py (test_insert_sample_data): Test inserting data. (test_delete_sample_data): Test deleting data.
2022-03-12Remove test cases related to sample dataBonfaceKilz
Most of this functions were moved to their own module.
2022-03-12Append case attributes to csv data if they existBonfaceKilz
2022-02-21Fix minor issues introduced while fixing linting errorsFrederick Muriuki Muriithi
2022-02-21Fix a myriad of linter issuesFrederick Muriuki Muriithi
* Use `with` in place of plain `open` * Use f-strings in place of `str.format()` * Remove string interpolation from queries - provide data as query parameters * other minor fixes
2022-02-21Add test to ensure samples are read correctly from .geno filesFrederick Muriuki Muriithi
* tests/unit/db/test_genotypes2.py: New file
2022-02-18Remove erroneous test based on wrong assumptionsFrederick Muriuki Muriithi
Related to commit 75dcfe295af57b16428c586cc11dbaa827a5feba This commit removes the related test that was checking for the wrong thing.
2022-02-17Use pytest's "mark" feature to categorise testsFrederick Muriuki Muriithi
Use pytest's `mark` feature to explicitly categorise the tests and run them per category
2022-02-09Remove obsolete `PublishFreeze` tableFrederick Muriuki Muriithi
2022-01-05test_traits.py: Update failing testBonfaceKilz
2021-12-14Provide expected values to use for testsFrederick Muriuki Muriithi
2021-11-23Fix a myriad of linting errorsFrederick Muriuki Muriithi
* Fix linting errors like: - Unused variables - Undeclared variable errors (mostly caused by typos, and wrong names) - Missing documentation strings for functions etc.
2021-11-22Add test to query buildersFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Add some tests for the query builders to ensure that the queries are built up correctly.
2021-10-19Disable pylint issueFrederick Muriuki Muriithi
* Disable minor pylint issue.
2021-10-19Move `export_informative` function to `gn3.db.traits` moduleFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/db/traits.py: Move `export_informative` function here * gn3/partial_correlations.py: Remove `export_informative` function * tests/unit/db/test_traits.py: Move `export_informative` function tests here * tests/unit/test_partial_correlations.py: Remove `export_informative` function tests The `export_informative` function relates more to the traits than to the partial correlations, and could find use in more than just the partial correlations stuff. This commit moves the function to the more traits-specific `gn3.db.traits` module.
2021-10-19Move 'export_trait_data' to 'gn3.db.traits' moduleFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/db/traits.py: Move function `export_trait_data` here * gn3/heatmaps.py: Remove function `export_trait_data` * tests/unit/db/test_traits.py: Move function `export_trait_data` tests here * tests/unit/test_heatmaps.py: Remove function `export_trait_data` here Function `export_trait_data` more closely corresponds to the traits and is used in more than just the `gn3.heatmaps` module. This commit moves the relevant code over to the `gn3.db.traits` module and also moves the tests to the corresponding tests modules.
2021-09-27Update terminology: `riset` to `group`Frederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Update terminology to use the appropriate domain terminology according to Zachary's direction at https://github.com/genenetwork/genenetwork3/pull/37#issuecomment-926041744
2021-09-23Refactor: Move common sample data to separate fileFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Move common sample test data into a separate file where it can be imported from, to prevent pylint error R0801 which proved tricky to silence in any other way.
2021-09-22Fix more pylint errorsFrederick Muriuki Muriithi
2021-09-15Add missing sample file for testsFrederick Muriuki Muriithi
* tests/unit/db/data/genotypes/genotype_sample1.geno: new file Add a missing sample data file needed for unit tests.
2021-09-01Fix linting and typing issuesMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi
2021-09-01Built top-level genotype file parsing functionMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/db/genotypes.py: parse genotype files * tests/unit/db/test_genotypes.py: test parsing is correct Add the overall genotype files parsing function and tests to check that the parsing works as expected.
2021-09-01Parse data lines into markersMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/db/genotypes.py: parse data lines in file to genetic markers. * tests/unit/db/test_genotypes.py: test that parsing works. Add some tests to check that the parsing of the markers works as expected, and add the code to actually parse the markers.
2021-09-01Parse the genotype file's data headerMuriithi Frederick Muriuki
* gn3/db/genotypes.py: parse data header * tests/unit/db/test_genotypes.py: check that header's parse works correctly. Add tests to check that the parser works as expected. Add code to implement the parsing and pass the tests.
2021-09-01Implement parsing of genotype labelsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/db/genotypes.py: parse genotype labels * tests/unit/db/test_genotypes.py: test that genotype labels are parsed correctly As part of parsing the genotype files into usable python data structures, this commit adds a function to parse the label lines (beginning with "@") into the appropriate values.
2021-08-09Set up the trait dataset type correctlyMuriithi Frederick Muriuki
* gn3/db/traits.py: setup `trait_dataset_type` * tests/unit/db/test_traits.py: fix tests The type ('Temp', 'Geno', 'Publish', and 'ProbeSet') relate to a trait's dataset, and not the trait itself. This commit updates the code to take this into consideration. The dataset type is also set up from a trait's full name, therefore this commit removes the `trait_type` argument from the `retrieve_trait_info` function.
2021-08-09Fix linting errorsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Add module, class and function docstrings * Deactivate some irrelevant pylint errors * Fix indentations and line-lengths
2021-08-08Update testsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Fix tests to take current changes into consideration.
2021-08-05Reorganise the database codeMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Reorganise the code to separate the datasets from the traits, and to more closely conform to the same flow as that in GN1
2021-08-05Build up trait_name items from full nameMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * The full name of the traits from search contains multiple parts to it, and as such, we use it to retrieve the appropriate data and set it up in the final trait_info dictionary that is produced.
2021-08-04Fix issues caught by pylintMuriithi Frederick Muriuki
* gn3/computations/slink.py: remove unused imports * gn3/db/traits.py: remove unnecessary `else` clauses * tests/unit/db/test_traits.py: add docstrings for functions
2021-08-04Retrieve the RISet and RISet ID valuesMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Retrieve the RISet and RISet ID values from the database.