diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f5cff33..6fb7597 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,6 +24,8 @@ jobs: python-version: '3.10' - os: 'ubuntu-22.04' python-version: '3.11' + - os: 'ubuntu-22.04' + python-version: '3.12' steps: - name: Check out repository uses: actions/checkout@v2 @@ -37,11 +39,13 @@ jobs: pip install coveralls poetry install - name: Run tests - run: poetry run coverage run -m pytest + run: | + poetry run coverage run -m pytest + poetry run coverage xml - name: Coveralls report - run: coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: coverallsapp/github-action@v2 + with: + parallel: true publish_to_pypi: # Only run this job if the run_tests job has succeeded, and if @@ -55,7 +59,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip poetry diff --git a/CHANGELOG b/CHANGELOG index 469fdf8..96d06d0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -50,3 +50,4 @@ v.0.4.11 - Add hour angle type target v.0.4.12 - Add zenith blind spot support v.0.5.1 - First release as ocs-rise-set v.0.5.2 - Added max moon_phase constraint support +v.0.6.4 - Support for python 3.12 and numpy > 1.23, Drop support for python 3.8 diff --git a/README.md b/README.md index f01c9e1..4613bb4 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This library provides Python routines for finding the positions of astronomical ## Prerequisites -- Python >= 3.7 +- Python >= 3.9 - Ability to compile fortran (gfortran installed) ## Installation diff --git a/poetry.lock b/poetry.lock index 0407f7f..3b833c4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand. [[package]] name = "colorama" @@ -6,6 +6,8 @@ version = "0.4.6" description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["dev"] +markers = "sys_platform == \"win32\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, @@ -13,62 +15,75 @@ files = [ [[package]] name = "coverage" -version = "7.2.3" +version = "7.7.0" description = "Code coverage measurement for Python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.9" +groups = ["dev"] files = [ - {file = "coverage-7.2.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e58c0d41d336569d63d1b113bd573db8363bc4146f39444125b7f8060e4e04f5"}, - {file = "coverage-7.2.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:344e714bd0fe921fc72d97404ebbdbf9127bac0ca1ff66d7b79efc143cf7c0c4"}, - {file = "coverage-7.2.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:974bc90d6f6c1e59ceb1516ab00cf1cdfbb2e555795d49fa9571d611f449bcb2"}, - {file = "coverage-7.2.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0743b0035d4b0e32bc1df5de70fba3059662ace5b9a2a86a9f894cfe66569013"}, - {file = "coverage-7.2.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5d0391fb4cfc171ce40437f67eb050a340fdbd0f9f49d6353a387f1b7f9dd4fa"}, - {file = "coverage-7.2.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4a42e1eff0ca9a7cb7dc9ecda41dfc7cbc17cb1d02117214be0561bd1134772b"}, - {file = "coverage-7.2.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:be19931a8dcbe6ab464f3339966856996b12a00f9fe53f346ab3be872d03e257"}, - {file = "coverage-7.2.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:72fcae5bcac3333a4cf3b8f34eec99cea1187acd55af723bcbd559adfdcb5535"}, - {file = "coverage-7.2.3-cp310-cp310-win32.whl", hash = "sha256:aeae2aa38395b18106e552833f2a50c27ea0000122bde421c31d11ed7e6f9c91"}, - {file = "coverage-7.2.3-cp310-cp310-win_amd64.whl", hash = "sha256:83957d349838a636e768251c7e9979e899a569794b44c3728eaebd11d848e58e"}, - {file = "coverage-7.2.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:dfd393094cd82ceb9b40df4c77976015a314b267d498268a076e940fe7be6b79"}, - {file = "coverage-7.2.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:182eb9ac3f2b4874a1f41b78b87db20b66da6b9cdc32737fbbf4fea0c35b23fc"}, - {file = "coverage-7.2.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1bb1e77a9a311346294621be905ea8a2c30d3ad371fc15bb72e98bfcfae532df"}, - {file = "coverage-7.2.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca0f34363e2634deffd390a0fef1aa99168ae9ed2af01af4a1f5865e362f8623"}, - {file = "coverage-7.2.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:55416d7385774285b6e2a5feca0af9652f7f444a4fa3d29d8ab052fafef9d00d"}, - {file = "coverage-7.2.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:06ddd9c0249a0546997fdda5a30fbcb40f23926df0a874a60a8a185bc3a87d93"}, - {file = "coverage-7.2.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:fff5aaa6becf2c6a1699ae6a39e2e6fb0672c2d42eca8eb0cafa91cf2e9bd312"}, - {file = "coverage-7.2.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ea53151d87c52e98133eb8ac78f1206498c015849662ca8dc246255265d9c3c4"}, - {file = "coverage-7.2.3-cp311-cp311-win32.whl", hash = "sha256:8f6c930fd70d91ddee53194e93029e3ef2aabe26725aa3c2753df057e296b925"}, - {file = "coverage-7.2.3-cp311-cp311-win_amd64.whl", hash = "sha256:fa546d66639d69aa967bf08156eb8c9d0cd6f6de84be9e8c9819f52ad499c910"}, - {file = "coverage-7.2.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2317d5ed777bf5a033e83d4f1389fd4ef045763141d8f10eb09a7035cee774c"}, - {file = "coverage-7.2.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:be9824c1c874b73b96288c6d3de793bf7f3a597770205068c6163ea1f326e8b9"}, - {file = "coverage-7.2.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2c3b2803e730dc2797a017335827e9da6da0e84c745ce0f552e66400abdfb9a1"}, - {file = "coverage-7.2.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f69770f5ca1994cb32c38965e95f57504d3aea96b6c024624fdd5bb1aa494a1"}, - {file = "coverage-7.2.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1127b16220f7bfb3f1049ed4a62d26d81970a723544e8252db0efde853268e21"}, - {file = "coverage-7.2.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:aa784405f0c640940595fa0f14064d8e84aff0b0f762fa18393e2760a2cf5841"}, - {file = "coverage-7.2.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:3146b8e16fa60427e03884301bf8209221f5761ac754ee6b267642a2fd354c48"}, - {file = "coverage-7.2.3-cp37-cp37m-win32.whl", hash = "sha256:1fd78b911aea9cec3b7e1e2622c8018d51c0d2bbcf8faaf53c2497eb114911c1"}, - {file = "coverage-7.2.3-cp37-cp37m-win_amd64.whl", hash = "sha256:0f3736a5d34e091b0a611964c6262fd68ca4363df56185902528f0b75dbb9c1f"}, - {file = "coverage-7.2.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:981b4df72c93e3bc04478153df516d385317628bd9c10be699c93c26ddcca8ab"}, - {file = "coverage-7.2.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:c0045f8f23a5fb30b2eb3b8a83664d8dc4fb58faddf8155d7109166adb9f2040"}, - {file = "coverage-7.2.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f760073fcf8f3d6933178d67754f4f2d4e924e321f4bb0dcef0424ca0215eba1"}, - {file = "coverage-7.2.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c86bd45d1659b1ae3d0ba1909326b03598affbc9ed71520e0ff8c31a993ad911"}, - {file = "coverage-7.2.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:172db976ae6327ed4728e2507daf8a4de73c7cc89796483e0a9198fd2e47b462"}, - {file = "coverage-7.2.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:d2a3a6146fe9319926e1d477842ca2a63fe99af5ae690b1f5c11e6af074a6b5c"}, - {file = "coverage-7.2.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:f649dd53833b495c3ebd04d6eec58479454a1784987af8afb77540d6c1767abd"}, - {file = "coverage-7.2.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:7c4ed4e9f3b123aa403ab424430b426a1992e6f4c8fd3cb56ea520446e04d152"}, - {file = "coverage-7.2.3-cp38-cp38-win32.whl", hash = "sha256:eb0edc3ce9760d2f21637766c3aa04822030e7451981ce569a1b3456b7053f22"}, - {file = "coverage-7.2.3-cp38-cp38-win_amd64.whl", hash = "sha256:63cdeaac4ae85a179a8d6bc09b77b564c096250d759eed343a89d91bce8b6367"}, - {file = "coverage-7.2.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:20d1a2a76bb4eb00e4d36b9699f9b7aba93271c9c29220ad4c6a9581a0320235"}, - {file = "coverage-7.2.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4ea748802cc0de4de92ef8244dd84ffd793bd2e7be784cd8394d557a3c751e21"}, - {file = "coverage-7.2.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:21b154aba06df42e4b96fc915512ab39595105f6c483991287021ed95776d934"}, - {file = "coverage-7.2.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd214917cabdd6f673a29d708574e9fbdb892cb77eb426d0eae3490d95ca7859"}, - {file = "coverage-7.2.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c2e58e45fe53fab81f85474e5d4d226eeab0f27b45aa062856c89389da2f0d9"}, - {file = "coverage-7.2.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:87ecc7c9a1a9f912e306997ffee020297ccb5ea388421fe62a2a02747e4d5539"}, - {file = "coverage-7.2.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:387065e420aed3c71b61af7e82c7b6bc1c592f7e3c7a66e9f78dd178699da4fe"}, - {file = "coverage-7.2.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ea3f5bc91d7d457da7d48c7a732beaf79d0c8131df3ab278e6bba6297e23c6c4"}, - {file = "coverage-7.2.3-cp39-cp39-win32.whl", hash = "sha256:ae7863a1d8db6a014b6f2ff9c1582ab1aad55a6d25bac19710a8df68921b6e30"}, - {file = "coverage-7.2.3-cp39-cp39-win_amd64.whl", hash = "sha256:3f04becd4fcda03c0160d0da9c8f0c246bc78f2f7af0feea1ec0930e7c93fa4a"}, - {file = "coverage-7.2.3-pp37.pp38.pp39-none-any.whl", hash = "sha256:965ee3e782c7892befc25575fa171b521d33798132692df428a09efacaffe8d0"}, - {file = "coverage-7.2.3.tar.gz", hash = "sha256:d298c2815fa4891edd9abe5ad6e6cb4207104c7dd9fd13aea3fdebf6f9b91259"}, + {file = "coverage-7.7.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a538a23119d1e2e2ce077e902d02ea3d8e0641786ef6e0faf11ce82324743944"}, + {file = "coverage-7.7.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1586ad158523f4133499a4f322b230e2cfef9cc724820dbd58595a5a236186f4"}, + {file = "coverage-7.7.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7b6c96d69928a3a6767fab8dc1ce8a02cf0156836ccb1e820c7f45a423570d98"}, + {file = "coverage-7.7.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7f18d47641282664276977c604b5a261e51fefc2980f5271d547d706b06a837f"}, + {file = "coverage-7.7.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2a1e18a85bd066c7c556d85277a7adf4651f259b2579113844835ba1a74aafd"}, + {file = "coverage-7.7.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:70f0925c4e2bfc965369f417e7cc72538fd1ba91639cf1e4ef4b1a6b50439b3b"}, + {file = "coverage-7.7.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:b0fac2088ec4aaeb5468b814bd3ff5e5978364bfbce5e567c44c9e2854469f6c"}, + {file = "coverage-7.7.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b3e212a894d8ae07fde2ca8b43d666a6d49bbbddb10da0f6a74ca7bd31f20054"}, + {file = "coverage-7.7.0-cp310-cp310-win32.whl", hash = "sha256:f32b165bf6dfea0846a9c9c38b7e1d68f313956d60a15cde5d1709fddcaf3bee"}, + {file = "coverage-7.7.0-cp310-cp310-win_amd64.whl", hash = "sha256:a2454b12a3f12cc4698f3508912e6225ec63682e2ca5a96f80a2b93cef9e63f3"}, + {file = "coverage-7.7.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a0a207c87a9f743c8072d059b4711f8d13c456eb42dac778a7d2e5d4f3c253a7"}, + {file = "coverage-7.7.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2d673e3add00048215c2cc507f1228a7523fd8bf34f279ac98334c9b07bd2656"}, + {file = "coverage-7.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f81fe93dc1b8e5673f33443c0786c14b77e36f1025973b85e07c70353e46882b"}, + {file = "coverage-7.7.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d8c7524779003d59948c51b4fcbf1ca4e27c26a7d75984f63488f3625c328b9b"}, + {file = "coverage-7.7.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c124025430249118d018dcedc8b7426f39373527c845093132196f2a483b6dd"}, + {file = "coverage-7.7.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:e7f559c36d5cdc448ee13e7e56ed7b6b5d44a40a511d584d388a0f5d940977ba"}, + {file = "coverage-7.7.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:37cbc7b0d93dfd133e33c7ec01123fbb90401dce174c3b6661d8d36fb1e30608"}, + {file = "coverage-7.7.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:7d2a65876274acf544703e943c010b60bd79404e3623a1e5d52b64a6e2728de5"}, + {file = "coverage-7.7.0-cp311-cp311-win32.whl", hash = "sha256:f5a2f71d6a91238e7628f23538c26aa464d390cbdedf12ee2a7a0fb92a24482a"}, + {file = "coverage-7.7.0-cp311-cp311-win_amd64.whl", hash = "sha256:ae8006772c6b0fa53c33747913473e064985dac4d65f77fd2fdc6474e7cd54e4"}, + {file = "coverage-7.7.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:056d3017ed67e7ddf266e6f57378ece543755a4c9231e997789ab3bd11392c94"}, + {file = "coverage-7.7.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:33c1394d8407e2771547583b66a85d07ed441ff8fae5a4adb4237ad39ece60db"}, + {file = "coverage-7.7.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4fbb7a0c3c21908520149d7751cf5b74eb9b38b54d62997b1e9b3ac19a8ee2fe"}, + {file = "coverage-7.7.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bb356e7ae7c2da13f404bf8f75be90f743c6df8d4607022e759f5d7d89fe83f8"}, + {file = "coverage-7.7.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bce730d484038e97f27ea2dbe5d392ec5c2261f28c319a3bb266f6b213650135"}, + {file = "coverage-7.7.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:aa4dff57fc21a575672176d5ab0ef15a927199e775c5e8a3d75162ab2b0c7705"}, + {file = "coverage-7.7.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b667b91f4f714b17af2a18e220015c941d1cf8b07c17f2160033dbe1e64149f0"}, + {file = "coverage-7.7.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:693d921621a0c8043bfdc61f7d4df5ea6d22165fe8b807cac21eb80dd94e4bbd"}, + {file = "coverage-7.7.0-cp312-cp312-win32.whl", hash = "sha256:52fc89602cde411a4196c8c6894afb384f2125f34c031774f82a4f2608c59d7d"}, + {file = "coverage-7.7.0-cp312-cp312-win_amd64.whl", hash = "sha256:0ce8cf59e09d31a4915ff4c3b94c6514af4c84b22c4cc8ad7c3c546a86150a92"}, + {file = "coverage-7.7.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:4545485fef7a8a2d8f30e6f79ce719eb154aab7e44217eb444c1d38239af2072"}, + {file = "coverage-7.7.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1393e5aa9441dafb0162c36c8506c648b89aea9565b31f6bfa351e66c11bcd82"}, + {file = "coverage-7.7.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:316f29cc3392fa3912493ee4c83afa4a0e2db04ff69600711f8c03997c39baaa"}, + {file = "coverage-7.7.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e1ffde1d6bc2a92f9c9207d1ad808550873748ac2d4d923c815b866baa343b3f"}, + {file = "coverage-7.7.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:416e2a8845eaff288f97eaf76ab40367deafb9073ffc47bf2a583f26b05e5265"}, + {file = "coverage-7.7.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5efdeff5f353ed3352c04e6b318ab05c6ce9249c25ed3c2090c6e9cadda1e3b2"}, + {file = "coverage-7.7.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:57f3bd0d29bf2bd9325c0ff9cc532a175110c4bf8f412c05b2405fd35745266d"}, + {file = "coverage-7.7.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:3ab7090f04b12dc6469882ce81244572779d3a4b67eea1c96fb9ecc8c607ef39"}, + {file = "coverage-7.7.0-cp313-cp313-win32.whl", hash = "sha256:180e3fc68ee4dc5af8b33b6ca4e3bb8aa1abe25eedcb958ba5cff7123071af68"}, + {file = "coverage-7.7.0-cp313-cp313-win_amd64.whl", hash = "sha256:55143aa13c49491f5606f05b49ed88663446dce3a4d3c5d77baa4e36a16d3573"}, + {file = "coverage-7.7.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:cc41374d2f27d81d6558f8a24e5c114580ffefc197fd43eabd7058182f743322"}, + {file = "coverage-7.7.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:89078312f06237417adda7c021c33f80f7a6d2db8572a5f6c330d89b080061ce"}, + {file = "coverage-7.7.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5b2f144444879363ea8834cd7b6869d79ac796cb8f864b0cfdde50296cd95816"}, + {file = "coverage-7.7.0-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:60e6347d1ed882b1159ffea172cb8466ee46c665af4ca397edbf10ff53e9ffaf"}, + {file = "coverage-7.7.0-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cb203c0afffaf1a8f5b9659a013f8f16a1b2cad3a80a8733ceedc968c0cf4c57"}, + {file = "coverage-7.7.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:ad0edaa97cb983d9f2ff48cadddc3e1fb09f24aa558abeb4dc9a0dbacd12cbb4"}, + {file = "coverage-7.7.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:c5f8a5364fc37b2f172c26a038bc7ec4885f429de4a05fc10fdcb53fb5834c5c"}, + {file = "coverage-7.7.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:c4e09534037933bf6eb31d804e72c52ec23219b32c1730f9152feabbd7499463"}, + {file = "coverage-7.7.0-cp313-cp313t-win32.whl", hash = "sha256:1b336d06af14f8da5b1f391e8dec03634daf54dfcb4d1c4fb6d04c09d83cef90"}, + {file = "coverage-7.7.0-cp313-cp313t-win_amd64.whl", hash = "sha256:b54a1ee4c6f1905a436cbaa04b26626d27925a41cbc3a337e2d3ff7038187f07"}, + {file = "coverage-7.7.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1c8fbce80b2b8bf135d105aa8f5b36eae0c57d702a1cc3ebdea2a6f03f6cdde5"}, + {file = "coverage-7.7.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d9710521f07f526de30ccdead67e6b236fe996d214e1a7fba8b36e2ba2cd8261"}, + {file = "coverage-7.7.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7789e700f33f2b133adae582c9f437523cd5db8de845774988a58c360fc88253"}, + {file = "coverage-7.7.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b8c36093aca722db73633cf2359026ed7782a239eb1c6db2abcff876012dc4cf"}, + {file = "coverage-7.7.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c075d167a6ec99b798c1fdf6e391a1d5a2d054caffe9593ba0f97e3df2c04f0e"}, + {file = "coverage-7.7.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:d013c07061751ae81861cae6ec3a4fe04e84781b11fd4b6b4201590234b25c7b"}, + {file = "coverage-7.7.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:104bf640f408f4e115b85110047c7f27377e1a8b7ba86f7db4fa47aa49dc9a8e"}, + {file = "coverage-7.7.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:39abcacd1ed54e2c33c54bdc488b310e8ef6705833f7148b6eb9a547199d375d"}, + {file = "coverage-7.7.0-cp39-cp39-win32.whl", hash = "sha256:8e336b56301774ace6be0017ff85c3566c556d938359b61b840796a0202f805c"}, + {file = "coverage-7.7.0-cp39-cp39-win_amd64.whl", hash = "sha256:8c938c6ae59be67ac19a7204e079efc94b38222cd7d0269f96e45e18cddeaa59"}, + {file = "coverage-7.7.0-pp39.pp310.pp311-none-any.whl", hash = "sha256:3b0e6e54591ae0d7427def8a4d40fca99df6b899d10354bab73cd5609807261c"}, + {file = "coverage-7.7.0-py3-none-any.whl", hash = "sha256:708f0a1105ef2b11c79ed54ed31f17e6325ac936501fc373f24be3e6a578146a"}, + {file = "coverage-7.7.0.tar.gz", hash = "sha256:cd879d4646055a573775a1cec863d00c9ff8c55860f8b17f6d8eee9140c06166"}, ] [package.extras] @@ -76,13 +91,15 @@ toml = ["tomli"] [[package]] name = "exceptiongroup" -version = "1.1.1" +version = "1.2.2" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" +groups = ["dev"] +markers = "python_version < \"3.11\"" files = [ - {file = "exceptiongroup-1.1.1-py3-none-any.whl", hash = "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e"}, - {file = "exceptiongroup-1.1.1.tar.gz", hash = "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"}, + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, ] [package.extras] @@ -94,6 +111,7 @@ version = "0.18.3" description = "Clean single-source support for Python 3 and 2" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +groups = ["main"] files = [ {file = "future-0.18.3.tar.gz", hash = "sha256:34a17436ed1e96697a86f9de3d15a3b0be01d8bc8de9c1dffd59fb8234ed5307"}, ] @@ -104,6 +122,7 @@ version = "2.0.0" description = "brain-dead simple config-ini parsing" optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, @@ -111,13 +130,14 @@ files = [ [[package]] name = "mock" -version = "5.0.1" +version = "5.2.0" description = "Rolling backport of unittest.mock for all Pythons" optional = false python-versions = ">=3.6" +groups = ["dev"] files = [ - {file = "mock-5.0.1-py3-none-any.whl", hash = "sha256:c41cfb1e99ba5d341fbcc5308836e7d7c9786d302f995b2c271ce2144dece9eb"}, - {file = "mock-5.0.1.tar.gz", hash = "sha256:e3ea505c03babf7977fd21674a69ad328053d414f05e6433c30d8fa14a534a6b"}, + {file = "mock-5.2.0-py3-none-any.whl", hash = "sha256:7ba87f72ca0e915175596069dbbcc7c75af7b5e9b9bc107ad6349ede0819982f"}, + {file = "mock-5.2.0.tar.gz", hash = "sha256:4e460e818629b4b173f32d08bf30d3af8123afbb8e04bb5707a1fd4799e503f0"}, ] [package.extras] @@ -125,90 +145,83 @@ build = ["blurb", "twine", "wheel"] docs = ["sphinx"] test = ["pytest", "pytest-cov"] -[[package]] -name = "nose" -version = "1.3.7" -description = "nose extends unittest to make testing easier" -optional = false -python-versions = "*" -files = [ - {file = "nose-1.3.7-py2-none-any.whl", hash = "sha256:dadcddc0aefbf99eea214e0f1232b94f2fa9bd98fa8353711dacb112bfcbbb2a"}, - {file = "nose-1.3.7-py3-none-any.whl", hash = "sha256:9ff7c6cc443f8c51994b34a667bbcf45afd6d945be7477b52e97516fd17c53ac"}, - {file = "nose-1.3.7.tar.gz", hash = "sha256:f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98"}, -] - -[[package]] -name = "nosexcover" -version = "1.0.11" -description = "Extends nose.plugins.cover to add Cobertura-style XML reports" -optional = false -python-versions = "*" -files = [ - {file = "nosexcover-1.0.11-py2.py3-none-any.whl", hash = "sha256:445de3e7f0b2d1bf0b53ac21aa924870eb2b46cc1aa4cc91629639a606b39177"}, - {file = "nosexcover-1.0.11.tar.gz", hash = "sha256:298c3c655da587f6cab8a666e9f4b150320032431062dea91353988d45c8b883"}, -] - -[package.dependencies] -coverage = ">=3.4" -nose = "*" - [[package]] name = "numpy" -version = "1.23.5" -description = "NumPy is the fundamental package for array computing with Python." +version = "2.0.2" +description = "Fundamental package for array computing in Python" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" +groups = ["main"] files = [ - {file = "numpy-1.23.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9c88793f78fca17da0145455f0d7826bcb9f37da4764af27ac945488116efe63"}, - {file = "numpy-1.23.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e9f4c4e51567b616be64e05d517c79a8a22f3606499941d97bb76f2ca59f982d"}, - {file = "numpy-1.23.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7903ba8ab592b82014713c491f6c5d3a1cde5b4a3bf116404e08f5b52f6daf43"}, - {file = "numpy-1.23.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5e05b1c973a9f858c74367553e236f287e749465f773328c8ef31abe18f691e1"}, - {file = "numpy-1.23.5-cp310-cp310-win32.whl", hash = "sha256:522e26bbf6377e4d76403826ed689c295b0b238f46c28a7251ab94716da0b280"}, - {file = "numpy-1.23.5-cp310-cp310-win_amd64.whl", hash = "sha256:dbee87b469018961d1ad79b1a5d50c0ae850000b639bcb1b694e9981083243b6"}, - {file = "numpy-1.23.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ce571367b6dfe60af04e04a1834ca2dc5f46004ac1cc756fb95319f64c095a96"}, - {file = "numpy-1.23.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:56e454c7833e94ec9769fa0f86e6ff8e42ee38ce0ce1fa4cbb747ea7e06d56aa"}, - {file = "numpy-1.23.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5039f55555e1eab31124a5768898c9e22c25a65c1e0037f4d7c495a45778c9f2"}, - {file = "numpy-1.23.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58f545efd1108e647604a1b5aa809591ccd2540f468a880bedb97247e72db387"}, - {file = "numpy-1.23.5-cp311-cp311-win32.whl", hash = "sha256:b2a9ab7c279c91974f756c84c365a669a887efa287365a8e2c418f8b3ba73fb0"}, - {file = "numpy-1.23.5-cp311-cp311-win_amd64.whl", hash = "sha256:0cbe9848fad08baf71de1a39e12d1b6310f1d5b2d0ea4de051058e6e1076852d"}, - {file = "numpy-1.23.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f063b69b090c9d918f9df0a12116029e274daf0181df392839661c4c7ec9018a"}, - {file = "numpy-1.23.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0aaee12d8883552fadfc41e96b4c82ee7d794949e2a7c3b3a7201e968c7ecab9"}, - {file = "numpy-1.23.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:92c8c1e89a1f5028a4c6d9e3ccbe311b6ba53694811269b992c0b224269e2398"}, - {file = "numpy-1.23.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d208a0f8729f3fb790ed18a003f3a57895b989b40ea4dce4717e9cf4af62c6bb"}, - {file = "numpy-1.23.5-cp38-cp38-win32.whl", hash = "sha256:06005a2ef6014e9956c09ba07654f9837d9e26696a0470e42beedadb78c11b07"}, - {file = "numpy-1.23.5-cp38-cp38-win_amd64.whl", hash = "sha256:ca51fcfcc5f9354c45f400059e88bc09215fb71a48d3768fb80e357f3b457e1e"}, - {file = "numpy-1.23.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8969bfd28e85c81f3f94eb4a66bc2cf1dbdc5c18efc320af34bffc54d6b1e38f"}, - {file = "numpy-1.23.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a7ac231a08bb37f852849bbb387a20a57574a97cfc7b6cabb488a4fc8be176de"}, - {file = "numpy-1.23.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf837dc63ba5c06dc8797c398db1e223a466c7ece27a1f7b5232ba3466aafe3d"}, - {file = "numpy-1.23.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:33161613d2269025873025b33e879825ec7b1d831317e68f4f2f0f84ed14c719"}, - {file = "numpy-1.23.5-cp39-cp39-win32.whl", hash = "sha256:af1da88f6bc3d2338ebbf0e22fe487821ea4d8e89053e25fa59d1d79786e7481"}, - {file = "numpy-1.23.5-cp39-cp39-win_amd64.whl", hash = "sha256:09b7847f7e83ca37c6e627682f145856de331049013853f344f37b0c9690e3df"}, - {file = "numpy-1.23.5-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:abdde9f795cf292fb9651ed48185503a2ff29be87770c3b8e2a14b0cd7aa16f8"}, - {file = "numpy-1.23.5-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f9a909a8bae284d46bbfdefbdd4a262ba19d3bc9921b1e76126b1d21c3c34135"}, - {file = "numpy-1.23.5-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:01dd17cbb340bf0fc23981e52e1d18a9d4050792e8fb8363cecbf066a84b827d"}, - {file = "numpy-1.23.5.tar.gz", hash = "sha256:1b1766d6f397c18153d40015ddfc79ddb715cabadc04d2d228d4e5a8bc4ded1a"}, + {file = "numpy-2.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:51129a29dbe56f9ca83438b706e2e69a39892b5eda6cedcb6b0c9fdc9b0d3ece"}, + {file = "numpy-2.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f15975dfec0cf2239224d80e32c3170b1d168335eaedee69da84fbe9f1f9cd04"}, + {file = "numpy-2.0.2-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:8c5713284ce4e282544c68d1c3b2c7161d38c256d2eefc93c1d683cf47683e66"}, + {file = "numpy-2.0.2-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:becfae3ddd30736fe1889a37f1f580e245ba79a5855bff5f2a29cb3ccc22dd7b"}, + {file = "numpy-2.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2da5960c3cf0df7eafefd806d4e612c5e19358de82cb3c343631188991566ccd"}, + {file = "numpy-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:496f71341824ed9f3d2fd36cf3ac57ae2e0165c143b55c3a035ee219413f3318"}, + {file = "numpy-2.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a61ec659f68ae254e4d237816e33171497e978140353c0c2038d46e63282d0c8"}, + {file = "numpy-2.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d731a1c6116ba289c1e9ee714b08a8ff882944d4ad631fd411106a30f083c326"}, + {file = "numpy-2.0.2-cp310-cp310-win32.whl", hash = "sha256:984d96121c9f9616cd33fbd0618b7f08e0cfc9600a7ee1d6fd9b239186d19d97"}, + {file = "numpy-2.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:c7b0be4ef08607dd04da4092faee0b86607f111d5ae68036f16cc787e250a131"}, + {file = "numpy-2.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:49ca4decb342d66018b01932139c0961a8f9ddc7589611158cb3c27cbcf76448"}, + {file = "numpy-2.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:11a76c372d1d37437857280aa142086476136a8c0f373b2e648ab2c8f18fb195"}, + {file = "numpy-2.0.2-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:807ec44583fd708a21d4a11d94aedf2f4f3c3719035c76a2bbe1fe8e217bdc57"}, + {file = "numpy-2.0.2-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:8cafab480740e22f8d833acefed5cc87ce276f4ece12fdaa2e8903db2f82897a"}, + {file = "numpy-2.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a15f476a45e6e5a3a79d8a14e62161d27ad897381fecfa4a09ed5322f2085669"}, + {file = "numpy-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13e689d772146140a252c3a28501da66dfecd77490b498b168b501835041f951"}, + {file = "numpy-2.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9ea91dfb7c3d1c56a0e55657c0afb38cf1eeae4544c208dc465c3c9f3a7c09f9"}, + {file = "numpy-2.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c1c9307701fec8f3f7a1e6711f9089c06e6284b3afbbcd259f7791282d660a15"}, + {file = "numpy-2.0.2-cp311-cp311-win32.whl", hash = "sha256:a392a68bd329eafac5817e5aefeb39038c48b671afd242710b451e76090e81f4"}, + {file = "numpy-2.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:286cd40ce2b7d652a6f22efdfc6d1edf879440e53e76a75955bc0c826c7e64dc"}, + {file = "numpy-2.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:df55d490dea7934f330006d0f81e8551ba6010a5bf035a249ef61a94f21c500b"}, + {file = "numpy-2.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8df823f570d9adf0978347d1f926b2a867d5608f434a7cff7f7908c6570dcf5e"}, + {file = "numpy-2.0.2-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:9a92ae5c14811e390f3767053ff54eaee3bf84576d99a2456391401323f4ec2c"}, + {file = "numpy-2.0.2-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:a842d573724391493a97a62ebbb8e731f8a5dcc5d285dfc99141ca15a3302d0c"}, + {file = "numpy-2.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c05e238064fc0610c840d1cf6a13bf63d7e391717d247f1bf0318172e759e692"}, + {file = "numpy-2.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0123ffdaa88fa4ab64835dcbde75dcdf89c453c922f18dced6e27c90d1d0ec5a"}, + {file = "numpy-2.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:96a55f64139912d61de9137f11bf39a55ec8faec288c75a54f93dfd39f7eb40c"}, + {file = "numpy-2.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ec9852fb39354b5a45a80bdab5ac02dd02b15f44b3804e9f00c556bf24b4bded"}, + {file = "numpy-2.0.2-cp312-cp312-win32.whl", hash = "sha256:671bec6496f83202ed2d3c8fdc486a8fc86942f2e69ff0e986140339a63bcbe5"}, + {file = "numpy-2.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:cfd41e13fdc257aa5778496b8caa5e856dc4896d4ccf01841daee1d96465467a"}, + {file = "numpy-2.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9059e10581ce4093f735ed23f3b9d283b9d517ff46009ddd485f1747eb22653c"}, + {file = "numpy-2.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:423e89b23490805d2a5a96fe40ec507407b8ee786d66f7328be214f9679df6dd"}, + {file = "numpy-2.0.2-cp39-cp39-macosx_14_0_arm64.whl", hash = "sha256:2b2955fa6f11907cf7a70dab0d0755159bca87755e831e47932367fc8f2f2d0b"}, + {file = "numpy-2.0.2-cp39-cp39-macosx_14_0_x86_64.whl", hash = "sha256:97032a27bd9d8988b9a97a8c4d2c9f2c15a81f61e2f21404d7e8ef00cb5be729"}, + {file = "numpy-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e795a8be3ddbac43274f18588329c72939870a16cae810c2b73461c40718ab1"}, + {file = "numpy-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f26b258c385842546006213344c50655ff1555a9338e2e5e02a0756dc3e803dd"}, + {file = "numpy-2.0.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fec9451a7789926bcf7c2b8d187292c9f93ea30284802a0ab3f5be8ab36865d"}, + {file = "numpy-2.0.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:9189427407d88ff25ecf8f12469d4d39d35bee1db5d39fc5c168c6f088a6956d"}, + {file = "numpy-2.0.2-cp39-cp39-win32.whl", hash = "sha256:905d16e0c60200656500c95b6b8dca5d109e23cb24abc701d41c02d74c6b3afa"}, + {file = "numpy-2.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:a3f4ab0caa7f053f6797fcd4e1e25caee367db3112ef2b6ef82d749530768c73"}, + {file = "numpy-2.0.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:7f0a0c6f12e07fa94133c8a67404322845220c06a9e80e85999afe727f7438b8"}, + {file = "numpy-2.0.2-pp39-pypy39_pp73-macosx_14_0_x86_64.whl", hash = "sha256:312950fdd060354350ed123c0e25a71327d3711584beaef30cdaa93320c392d4"}, + {file = "numpy-2.0.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26df23238872200f63518dd2aa984cfca675d82469535dc7162dc2ee52d9dd5c"}, + {file = "numpy-2.0.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:a46288ec55ebbd58947d31d72be2c63cbf839f0a63b49cb755022310792a3385"}, + {file = "numpy-2.0.2.tar.gz", hash = "sha256:883c987dee1880e2a864ab0dc9892292582510604156762362d9326444636e78"}, ] [[package]] name = "packaging" -version = "23.0" +version = "24.2" description = "Core utilities for Python packages" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" +groups = ["dev"] files = [ - {file = "packaging-23.0-py3-none-any.whl", hash = "sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2"}, - {file = "packaging-23.0.tar.gz", hash = "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"}, + {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, + {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, ] [[package]] name = "pluggy" -version = "1.0.0" +version = "1.5.0" description = "plugin and hook calling mechanisms for python" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" +groups = ["dev"] files = [ - {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, - {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, ] [package.extras] @@ -217,26 +230,28 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pyslalib" -version = "1.0.9" +version = "1.0.10" description = "f2py and numpy based wrappers for SLALIB" optional = false -python-versions = "<3.12,>=3.8" +python-versions = ">=3.8" +groups = ["main"] files = [ - {file = "pyslalib-1.0.9.tar.gz", hash = "sha256:62f1f263d3ffb029bf9c0c0f0688a0ba55be379e7b7df775821e27c2ead7a8b5"}, + {file = "pyslalib-1.0.10.tar.gz", hash = "sha256:da8663bdf9db51e345214a0add057ca7f52f7a892302044e8449b730dac1b085"}, ] [package.dependencies] -numpy = "<1.24" +numpy = ">=1.23" [[package]] name = "pytest" -version = "7.3.0" +version = "7.4.4" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ - {file = "pytest-7.3.0-py3-none-any.whl", hash = "sha256:933051fa1bfbd38a21e73c3960cebdad4cf59483ddba7696c48509727e17f201"}, - {file = "pytest-7.3.0.tar.gz", hash = "sha256:58ecc27ebf0ea643ebfdf7fb1249335da761a00c9f955bcd922349bcb68ee57d"}, + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, ] [package.dependencies] @@ -248,20 +263,52 @@ pluggy = ">=0.12,<2.0" tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "tomli" -version = "2.0.1" +version = "2.2.1" description = "A lil' TOML parser" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" +groups = ["dev"] +markers = "python_version < \"3.11\"" files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, + {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, + {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, + {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, + {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, + {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, + {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, + {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, + {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, + {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, + {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, ] [metadata] -lock-version = "2.0" -python-versions = ">=3.8,<3.12" -content-hash = "92efb45e3eeaefc4ba39c63f5aeec2d17f77407aa8e576c9b353257c915377ae" +lock-version = "2.1" +python-versions = ">=3.9,<3.13" +content-hash = "b34e88b1c1aa92748ea3f1c554d7580a60b4ae74fc7245ce0602d4ee8f623158" diff --git a/pyproject.toml b/pyproject.toml index afebf42..617344e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ocs-rise-set" -version = "0.6.3" +version = "0.6.4" description = "Routines for accurate rise/set/transit calculations" authors = ["Eric Saunders "] readme = "README.md" @@ -12,14 +12,12 @@ classifiers = [ ] [tool.poetry.dependencies] -python = ">=3.8,<3.12" +python = ">=3.9,<3.13" future = "^0.18.3" -pyslalib = "1.0.9" +pyslalib = "^1.0.10" [tool.poetry.group.dev.dependencies] mock = "^5.0.1" -nose = "^1.3.7" -nosexcover = "^1.0.11" coverage = "^7.2.3" pytest = "^7.3.0" diff --git a/test/angle_test.py b/test/angle_test.py index fe90c49..ca6383a 100644 --- a/test/angle_test.py +++ b/test/angle_test.py @@ -2,7 +2,7 @@ from __future__ import division from builtins import object -from nose.tools import assert_equal, assert_almost_equal, raises +import pytest from math import pi @@ -14,255 +14,254 @@ class TestAngle(object): '''Unit tests for the angle.Angle class.''' # Test constructor errors - @raises(AngleConfigError) def test_invalid_angle_none(self): - self.angle = Angle() + with pytest.raises(AngleConfigError): + self.angle = Angle() - @raises(AngleConfigError) def test_invalid_angle_type(self): - self.angle = Angle(units = 'time') + with pytest.raises(AngleConfigError): + self.angle = Angle(units = 'time') - @raises(AngleConfigError) def test_invalid_angle_units(self): - self.angle = Angle(degrees = 45, units = 'kilos') + with pytest.raises(AngleConfigError): + self.angle = Angle(degrees = 45, units = 'kilos') - @raises(AngleConfigError) def test_invalid_multiple_angles(self): - self.angle = Angle(degrees = 45, radians = pi/4) + with pytest.raises(AngleConfigError): + self.angle = Angle(degrees = 45, radians = pi/4) # Test degree functionality def test_in_degrees(self): self.angle = Angle(degrees=37) - assert_equal(self.angle.in_degrees(), 37) + assert self.angle.in_degrees() == 37 def test_in_degrees_rads_provided(self): self.angle = Angle(radians=pi) - assert_equal(self.angle.in_degrees(), 180) + assert self.angle.in_degrees() == 180 def test_in_degrees_negative(self): self.angle = Angle(degrees = -37) - assert_equal(self.angle.in_degrees(), -37) + assert self.angle.in_degrees() == -37 # Test radian functionality def test_in_radians_rads_provided(self): self.angle = Angle(radians=2*pi) - assert_equal(self.angle.in_radians(), 2*pi) + assert self.angle.in_radians() == 2*pi def test_in_radians_degrees_provided(self): self.angle = Angle(degrees=180) - assert_equal(self.angle.in_radians(), pi) + assert self.angle.in_radians() == pi def test_in_radians_degrees_provided_time(self): self.angle = Angle(degrees=12, units = 'time') - assert_equal(self.angle.in_radians(), pi) + assert self.angle.in_radians() == pi def test_in_radians_negative(self): self.angle = Angle(radians = -pi) - assert_equal(self.angle.in_radians(), -pi) + assert self.angle.in_radians() == -pi # Test valid sexegesimal->degrees conversion given units = time def test_from_sexegesimal_hrs_time(self): self.angle = Angle(degrees='12:00:00', units= 'time') - assert_equal(self.angle.in_degrees(), 180) + assert self.angle.in_degrees() == 180 def test_from_sexegesimal_more_hrs_time(self): self.angle = Angle(degrees='120:00:00', units= 'time') - assert_equal(self.angle.in_degrees(), 1800) + assert self.angle.in_degrees() == 1800 def test_from_sexegesimal_hrs_mins_time(self): self.angle = Angle(degrees='12:30:00', units = 'time') - assert_equal(self.angle.in_degrees(), 187.5) + assert self.angle.in_degrees() == 187.5 def test_from_sexegesimal_hrs_secs_time(self): self.angle = Angle(degrees='12:30:30', units = 'time') - assert_equal(self.angle.in_degrees(), 187.625) + assert self.angle.in_degrees() == 187.625 def test_from_sexegesimal_fractional_secs_time(self): self.angle = Angle(degrees='12:30:30.1', units = 'time') - assert_equal(self.angle.in_degrees(), (187.625 + (360/24/36000))) + assert self.angle.in_degrees() == (187.625 + (360/24/36000)) def test_from_sexegesimal_negative_time(self): self.angle = Angle(degrees='-12:00:00', units = 'time') - assert_equal(self.angle.in_degrees(), -180) + assert self.angle.in_degrees() == -180 def test_from_sexegesimal_positive_time(self): self.angle = Angle(degrees='+12:00:00', units = 'time') - assert_equal(self.angle.in_degrees(), 180) + assert self.angle.in_degrees() == 180 def test_from_sexegesimal_zero_time(self): self.angle = Angle(degrees='0 0 0', units = 'time') - assert_equal(self.angle.in_degrees(), 0.0) + assert self.angle.in_degrees() == 0.0 # Test valid sexegesimal->degrees conversion given units = arc def test_from_sexegesimal_hrs_arc(self): self.angle = Angle(degrees='12:00:00') - assert_equal(self.angle.in_degrees(), 12) + assert self.angle.in_degrees() == 12 def test_from_sexegesimal_more_hrs_arc(self): self.angle = Angle(degrees='120:00:00') - assert_equal(self.angle.in_degrees(), 120) + assert self.angle.in_degrees() == 120 def test_from_sexegesimal_hrs_mins_arc(self): self.angle = Angle(degrees='12:30:00') - assert_equal(self.angle.in_degrees(), 12.5) + assert self.angle.in_degrees() == 12.5 def test_from_sexegesimal_hrs_secs_arc(self): self.angle = Angle(degrees='12:30:30') - assert_almost_equal(self.angle.in_degrees(), 12.50833, 5) + assert self.angle.in_degrees() == pytest.approx(12.50833, 0.00001) def test_from_sexegesimal_fractional_secs_arc(self): self.angle = Angle(degrees='12:30:30.1') - assert_almost_equal(self.angle.in_degrees(), 12.50836, 5) + assert self.angle.in_degrees() == pytest.approx(12.50836, 0.00001) def test_from_sexegesimal_negative_arc(self): self.angle = Angle(degrees='-12:00:00') - assert_equal(self.angle.in_degrees(), -12.0) + assert self.angle.in_degrees() == -12.0 def test_from_sexegesimal_positive_arc(self): self.angle = Angle(degrees='+12:00:00') - assert_equal(self.angle.in_degrees(), 12.0) + assert self.angle.in_degrees() == 12.0 def test_from_sexegesimal_zero_arc(self): self.angle = Angle(degrees='0 0 0') - assert_equal(self.angle.in_degrees(), 0.0) + assert self.angle.in_degrees() == 0.0 # Test various valid input forms for sexegesimal def test_from_sexegesimal_valid_format_colons(self): self.angle = Angle(degrees='12:30:30', units = 'time') - assert_equal(self.angle.in_degrees(), 187.625) + assert self.angle.in_degrees() == 187.625 def test_from_sexegesimal_valid_format_one_space(self): self.angle = Angle(degrees='12 30 30', units = 'time') - assert_equal(self.angle.in_degrees(), 187.625) + assert self.angle.in_degrees() == 187.625 def test_from_sexegesimal_valid_format_many_spaces(self): self.angle = Angle(degrees='12 30 30', units = 'time') - assert_equal(self.angle.in_degrees(), 187.625) + assert self.angle.in_degrees() == 187.625 def test_from_sexegesimal_valid_format_weird_delims(self): self.angle = Angle(degrees='12$$30$$30', units = 'time') - assert_equal(self.angle.in_degrees(), 187.625) + assert self.angle.in_degrees() == 187.625 # Test sexegesimal validation on various illegal inputs - @raises(InvalidAngleError) def test_from_sexegesimal_invalid_format_number_mins_too_long(self): - self.angle = Angle(degrees='12:0120:00') + with pytest.raises(InvalidAngleError): + self.angle = Angle(degrees='12:0120:00') - @raises(InvalidAngleError) def test_from_sexegesimal_invalid_format_secs_too_long(self): - self.angle = Angle(degrees='12:00:0032') + with pytest.raises(InvalidAngleError): + self.angle = Angle(degrees='12:00:0032') - @raises(InvalidAngleError) def test_from_sexegesimal_invalid_format_min_too_small(self): - self.angle = Angle(degrees='12:-1:00') + with pytest.raises(InvalidAngleError): + self.angle = Angle(degrees='12:-1:00') - @raises(InvalidAngleError) def test_from_sexegesimal_invalid_format_sec_too_small(self): - self.angle = Angle(degrees='12:00:-1.0') + with pytest.raises(InvalidAngleError): + self.angle = Angle(degrees='12:00:-1.0') - @raises(InvalidAngleError) def test_from_sexegesimal_invalid_format_no_delimiters(self): - self.angle = Angle(degrees = '123030') + with pytest.raises(InvalidAngleError): + self.angle = Angle(degrees = '123030') - @raises(InvalidAngleError) def test_from_sexegesimal_invalid_format_minuses(self): - self.angle = Angle(degrees = '12-30-30', units = 'time') + with pytest.raises(InvalidAngleError): + self.angle = Angle(degrees = '12-30-30', units = 'time') # Test returning degrees in sexegesimal def test_in_sexegesimal_degrees_str_arc(self): self.angle = Angle(degrees = '12 30 30') - assert_equal(self.angle.in_sexegesimal(), '12 30 30') + assert self.angle.in_sexegesimal() == '12 30 30' def test_in_sexegesimal_degrees_num_arc(self): self.angle = Angle(degrees = 45) - assert_equal(self.angle.in_sexegesimal(), '45 0 0') + assert self.angle.in_sexegesimal() == '45 0 0' def test_in_sexegesimal_degrees_negative_num_arc(self): self.angle = Angle(degrees = -90) - assert_equal(self.angle.in_sexegesimal(), '-90 0 0') + assert self.angle.in_sexegesimal() == '-90 0 0' def test_in_sexegesimal_degrees_negative_str_arc(self): self.angle = Angle(degrees = '-12 00 00') - assert_equal(self.angle.in_sexegesimal(), '-12 0 0') + assert self.angle.in_sexegesimal() == '-12 0 0' def test_in_sexegesimal_degrees_str_time(self): self.angle = Angle(degrees = '12 30 30', units = 'time') - assert_equal(self.angle.in_sexegesimal(), '12 30 30') + assert self.angle.in_sexegesimal() == '12 30 30' def test_in_sexegesimal_degrees_num_time(self): self.angle = Angle(degrees = 12.5, units = 'time') - assert_equal(self.angle.in_sexegesimal(), '12 30 0') + assert self.angle.in_sexegesimal() == '12 30 0' def test_in_sexegesimal_degrees_negative_num_time(self): self.angle = Angle(degrees = -12.5, units = 'time') - assert_equal(self.angle.in_sexegesimal(), '-12 30 0') + assert self.angle.in_sexegesimal() == '-12 30 0' def test_in_sexegesimal_degrees_negative_str_time(self): self.angle = Angle(degrees = '-12 00 00', units = 'time') - assert_equal(self.angle.in_sexegesimal(), '-12 0 0') + assert self.angle.in_sexegesimal() == '-12 0 0' # Test returning radians in sexegesimal def test_in_sexegesimal_radians_str_arc(self): self.angle = Angle(radians = '12 30 30') - assert_equal(self.angle.in_sexegesimal(radians = True), '12 30 30') + assert self.angle.in_sexegesimal(radians = True) == '12 30 30' def test_in_sexegesimal_radians_negative_str_arc(self): self.angle = Angle(radians = '-2 00 00') - assert_equal(self.angle.in_sexegesimal(radians = True), '-2 0 0') + assert self.angle.in_sexegesimal(radians = True) == '-2 0 0' def test_in_sexegesimal_radians_str_time(self): self.angle = Angle(radians = '12 30 30', units = 'time') - assert_equal(self.angle.in_sexegesimal(radians = True), '12 30 30') + assert self.angle.in_sexegesimal(radians = True) == '12 30 30' def test_in_sexegesimal_radians_negative_str_time(self): self.angle = Angle(radians = '-3 00 00', units = 'time') - assert_equal(self.angle.in_sexegesimal(radians = True), '-3 0 0') + assert self.angle.in_sexegesimal(radians = True) == '-3 0 0' # Test converting degrees to radians sexegesimal def test_in_sexegesimal_degrees_to_radians_arc(self): self.angle = Angle(degrees = 180) - assert_equal(self.angle.in_sexegesimal(radians = True), '3 8 29.7335529233') + assert self.angle.in_sexegesimal(radians = True) == '3 8 29.7335529233' def test_in_sexegesimal__negative_degrees_to_radians_arc(self): self.angle = Angle(degrees = -180) - assert_equal(self.angle.in_sexegesimal(radians = True), '-3 8 29.7335529233') + assert self.angle.in_sexegesimal(radians = True) == '-3 8 29.7335529233' def test_in_sexegesimal_degrees_to_radians_time(self): self.angle = Angle(degrees = 12, units = 'time') - assert_equal(self.angle.in_sexegesimal(radians = True), '3 8 29.7335529233') + assert self.angle.in_sexegesimal(radians = True) == '3 8 29.7335529233' def test_in_sexegesimal_negative_degrees_to_radians_time(self): self.angle = Angle(degrees = -12, units = 'time') - assert_equal(self.angle.in_sexegesimal(radians = True), '-3 8 29.7335529233') + assert self.angle.in_sexegesimal(radians = True) == '-3 8 29.7335529233' def test_in_sexegesimal_radians_to_degrees_arc(self): self.angle = Angle(radians = pi) - assert_equal(self.angle.in_sexegesimal(), '180 0 0') + assert self.angle.in_sexegesimal() == '180 0 0' def test_in_sexegesimal_negative_radians_to_degrees_arc(self): self.angle = Angle(radians = -2*pi) - assert_equal(self.angle.in_sexegesimal(), '-360 0 0') + assert self.angle.in_sexegesimal() == '-360 0 0' def test_in_sexegesimal_radians_to_degrees_time(self): self.angle = Angle(radians = pi, units = 'time') - assert_equal(self.angle.in_sexegesimal(), '180 0 0') + assert self.angle.in_sexegesimal() == '180 0 0' def test_in_sexegesimal_negative_radians_to_degrees_time(self): self.angle = Angle(radians = -2*pi, units = 'time') - assert_equal(self.angle.in_sexegesimal(), '-360 0 0') - + assert self.angle.in_sexegesimal() == '-360 0 0' diff --git a/test/astrometry_test.py b/test/astrometry_test.py index e741462..2a53108 100644 --- a/test/astrometry_test.py +++ b/test/astrometry_test.py @@ -2,7 +2,7 @@ from __future__ import division from builtins import object -from nose.tools import assert_equal, assert_almost_equal, assert_less, raises, assert_greater +import pytest from datetime import datetime, timedelta #Import the module to test @@ -33,7 +33,7 @@ def test_pre2009_jan1_leapsecond(self): date = datetime(2008, 12, 31, 12, 0, 0) received = date_to_tdb(date) expected = 54831.5 + (65.184/86400) - assert_equal(received, expected) + assert received == expected @@ -47,42 +47,39 @@ def setup_method(self): def test_gregorian_to_ut_mjd(self): - assert_equal(gregorian_to_ut_mjd(self.date), self.mjd) + assert gregorian_to_ut_mjd(self.date) == self.mjd def test_gregorian_to_ut_mjd_microseconds(self): dt = datetime(2014, 6, 14) tdb = dt - timedelta(seconds=67.184) mjd_micros = 56821.99922240741 - assert_equal(gregorian_to_ut_mjd(tdb), mjd_micros) + assert gregorian_to_ut_mjd(tdb) == mjd_micros def test_date_to_tdb(self): date = datetime(2013, 11, 4) received = date_to_tdb(date) expected = 56600.0 + (67.184/86400) - assert_equal(received, expected) + assert received == expected - @raises(InvalidDateTimeError) def test_gregorian_to_ut_mjd_bad_month(self): - gregorian_to_ut_mjd(self.bad_month) + with pytest.raises(InvalidDateTimeError): + gregorian_to_ut_mjd(self.bad_month) -# def test_ut_mjd_to_gmst_in_radians(self): -# assert_equal(ut_mjd_to_gmst_in_radians(self.mjd), 4) - - @raises(IncompleteTargetError) def test_missing_ra_raises_exception(self): tdb = self.mjd target_missing_ra = dict(dec='18 26 27.3') - mean_to_apparent(target_missing_ra, tdb) + with pytest.raises(IncompleteTargetError): + mean_to_apparent(target_missing_ra, tdb) - @raises(IncompleteTargetError) def test_missing_dec_raises_exception(self): tdb = self.mjd target_missing_dec = dict(ra='02 46 55.51') - mean_to_apparent(target_missing_dec, tdb) + with pytest.raises(IncompleteTargetError): + mean_to_apparent(target_missing_dec, tdb) def test_calc_local_hour_angle(self): @@ -92,7 +89,7 @@ def test_calc_local_hour_angle(self): hour_angle = calc_local_hour_angle(ra_app, elp_longitude, date) - assert_almost_equal(hour_angle.in_degrees(), -55.128564469690645, places=13) + assert hour_angle.in_degrees() == pytest.approx(-55.128564469690645, 0.0000000000001) def test_calc_local_hour_angle_normalises_negative_overrun(self): @@ -103,7 +100,7 @@ def test_calc_local_hour_angle_normalises_negative_overrun(self): hour_angle = calc_local_hour_angle(ra_app, elp_longitude, date) - assert_almost_equal(hour_angle.in_degrees(), 8.2509, places=4) + assert hour_angle.in_degrees() == pytest.approx(8.2509, 0.0001) def test_calc_local_hour_angle_normalises_positive_overrun(self): @@ -113,7 +110,7 @@ def test_calc_local_hour_angle_normalises_positive_overrun(self): hour_angle = calc_local_hour_angle(ra_app, coj_longitude, date) - assert_almost_equal(hour_angle.in_degrees(), 2.3088, places=4) + assert hour_angle.in_degrees() == pytest.approx(2.3088, 0.0001) class TestMoon(object): @@ -135,7 +132,7 @@ def setup_method(self): def test_apparent_position(self): dt_tdb = gregorian_to_ut_mjd(datetime(2012, 1, 3)) - assert_equal(dt_tdb, 55929.0) + assert dt_tdb == 55929.0 (apparent_ra, apparent_dec, diameter) = apparent_planet_pos("moon", dt_tdb, self.site) @@ -143,8 +140,8 @@ def test_apparent_position(self): expected_ra = Angle(degrees=26.63848) expected_dec = Angle(degrees=15.61778) - assert_less(abs(apparent_ra.in_degrees() - expected_ra.in_degrees()), self.tolerance) - assert_less(abs(apparent_dec.in_degrees() - expected_dec.in_degrees()), self.tolerance) + assert abs(apparent_ra.in_degrees() - expected_ra.in_degrees()) < self.tolerance + assert abs(apparent_dec.in_degrees() - expected_dec.in_degrees()) < self.tolerance def test_rise_set_12_31(self): dt_utc = datetime(2011, 12, 31) @@ -160,9 +157,9 @@ def test_rise_set_12_31(self): expected_transit = timedelta(hours=17, minutes=27) expected_set = timedelta(hours=23, minutes=22) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_1_1(self): dt_utc = datetime(2012, 1, 1) @@ -178,9 +175,9 @@ def test_rise_set_1_1(self): expected_transit = timedelta(hours=18, minutes=9) expected_set = timedelta(hours=23, minutes=54) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_1_2(self): dt_utc = datetime(2012, 1, 2) @@ -195,8 +192,8 @@ def test_rise_set_1_2(self): expected_rise = timedelta(hours=13, minutes=16) expected_transit = timedelta(hours=18, minutes=52) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_1_3(self): dt_utc = datetime(2012, 1, 3) @@ -210,9 +207,9 @@ def test_rise_set_1_3(self): expected_rise = timedelta(hours=14, minutes=10) expected_transit = timedelta(hours=19, minutes=37) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_1_4(self): dt_utc = datetime(2012, 1, 4) @@ -226,9 +223,9 @@ def test_rise_set_1_4(self): expected_rise = timedelta(hours=15, minutes=4) expected_transit = timedelta(hours=20, minutes=24) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_1_31(self): dt_utc = datetime(2012, 1, 31) @@ -242,9 +239,9 @@ def test_rise_set_1_31(self): expected_rise = timedelta(hours=12, minutes=53) expected_transit = timedelta(hours=18, minutes=17) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_2_1(self): dt_utc = datetime(2012, 2, 1) @@ -258,9 +255,9 @@ def test_rise_set_2_1(self): expected_rise = timedelta(hours=13, minutes=47) expected_transit = timedelta(hours=19, minutes=5) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_2_2(self): dt_utc = datetime(2012, 2, 2) @@ -274,9 +271,9 @@ def test_rise_set_2_2(self): expected_rise = timedelta(hours=14, minutes=40) expected_transit = timedelta(hours=19, minutes=55) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_2_3(self): dt_utc = datetime(2012, 2, 3) @@ -290,9 +287,9 @@ def test_rise_set_2_3(self): expected_rise = timedelta(hours=15, minutes=31) expected_transit = timedelta(hours=20, minutes=47) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_2_15(self): @@ -305,8 +302,8 @@ def test_rise_set_2_15(self): # moon doesnt rise on this day, but rise_set returns the rise time for the next day expected_transit = timedelta(hours=6, minutes=26) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_3_1(self): dt_utc = datetime(2012, 3, 1) @@ -318,9 +315,9 @@ def test_rise_set_3_1(self): expected_rise = timedelta(hours=13, minutes=20) expected_transit = timedelta(hours=18, minutes=35) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_5_1(self): @@ -333,9 +330,9 @@ def test_rise_set_5_1(self): expected_rise = timedelta(hours=14, minutes=3) expected_transit = timedelta(hours=20, minutes=8) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_6_15(self): @@ -348,9 +345,9 @@ def test_rise_set_6_15(self): expected_rise = timedelta(hours=3, minutes=13) expected_transit = timedelta(hours=8, minutes=42) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_8_1(self): @@ -363,9 +360,9 @@ def test_rise_set_8_1(self): expected_rise = timedelta(hours=17, minutes=5) expected_transit = timedelta(hours=23, minutes=53) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_9_15(self): dt_utc = datetime(2012, 9, 15) @@ -377,9 +374,9 @@ def test_rise_set_9_15(self): expected_rise = timedelta(hours=5, minutes=13) expected_transit = timedelta(hours=11, minutes=20) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance def test_rise_set_11_1(self): dt_utc = datetime(2012, 11, 1) @@ -391,9 +388,9 @@ def test_rise_set_11_1(self): expected_rise = timedelta(hours=20, minutes=52) expected_transit = timedelta(hours=1, minutes=22) - assert_less(abs(sets.total_seconds() - expected_set.total_seconds()), self.time_tolerance) - assert_less(abs(rises.total_seconds() - expected_rise.total_seconds()), self.time_tolerance) - assert_less(abs(transits.total_seconds() - expected_transit.total_seconds()), self.time_tolerance) + assert abs(sets.total_seconds() - expected_set.total_seconds()) < self.time_tolerance + assert abs(rises.total_seconds() - expected_rise.total_seconds()) < self.time_tolerance + assert abs(transits.total_seconds() - expected_transit.total_seconds()) < self.time_tolerance class TestSunriseSunset(object): @@ -423,8 +420,8 @@ def test_nautical_twilight_from_lsc_no_time(self): received = calc_sunrise_set(self.lsc, date, twilight) # We only know these to the nearest 30s from USNO online calculator - assert_less(abs(expected[1]-received[1]), timedelta(seconds=30)) - assert_less(abs(expected[2]-received[2]), timedelta(seconds=30)) + assert abs(expected[1]-received[1]) < timedelta(seconds=30) + assert abs(expected[2]-received[2]) < timedelta(seconds=30) def test_nautical_twilight_from_lsc_with_time(self): @@ -437,8 +434,8 @@ def test_nautical_twilight_from_lsc_with_time(self): received = calc_sunrise_set(self.lsc, date, twilight) # We only know these to the nearest 30s from USNO online calculator - assert_less(abs(expected[1]-received[1]), timedelta(seconds=30)) - assert_less(abs(expected[2]-received[2]), timedelta(seconds=30)) + assert abs(expected[1]-received[1]) < timedelta(seconds=30) + assert abs(expected[2]-received[2]) < timedelta(seconds=30) def test_sunrise_set_from_elp_no_time(self): @@ -451,8 +448,8 @@ def test_sunrise_set_from_elp_no_time(self): received = calc_sunrise_set(self.elp, date, twilight) # We only know these to the nearest 30s from USNO online calculator - assert_less(abs(expected[1]-received[1]), timedelta(seconds=30)) - assert_less(abs(expected[2]-received[2]), timedelta(seconds=30)) + assert abs(expected[1]-received[1]) < timedelta(seconds=30) + assert abs(expected[2]-received[2]) < timedelta(seconds=30) def test_sunrise_set_from_elp_with_time(self): @@ -465,8 +462,8 @@ def test_sunrise_set_from_elp_with_time(self): received = calc_sunrise_set(self.elp, date, twilight) # We only know these to the nearest 30s from USNO online calculator - assert_less(abs(expected[1]-received[1]), timedelta(seconds=30)) - assert_less(abs(expected[2]-received[2]), timedelta(seconds=30)) + assert abs(expected[1]-received[1]) < timedelta(seconds=30) + assert abs(expected[2]-received[2]) < timedelta(seconds=30) @@ -489,27 +486,27 @@ def setup_method(self): def test_calc_transit_day_fraction(self): m_0 = calc_transit_day_fraction(self.alpha_2, self.boston['longitude'], self.app_sidereal_time) - assert_almost_equal(m_0, 0.81965, places=5) + assert m_0 == pytest.approx(0.81965, 0.00001) (hour_angle, _) = calc_rise_set_hour_angle(self.boston['latitude'], self.delta_2, self.std_alt) - assert_almost_equal(hour_angle.in_degrees(), 108.5344, places=4) + assert hour_angle.in_degrees() == pytest.approx(108.5344, 0.0001) m_1 = calc_rising_day_fraction(m_0, hour_angle) - assert_almost_equal(m_1, 0.51816, places=5) + assert m_1 == pytest.approx(0.51816, 0.00001) m_2 = calc_setting_day_fraction(m_0, hour_angle) - assert_almost_equal(m_2, 0.12113, places=5) + assert m_2 == pytest.approx(0.12113, 0.00001) def test_day_frac_to_hms(self): (hrs, mins, secs) = day_frac_to_hms(0.531712963) - assert_equal(hrs, 12) - assert_equal(mins, 45) - assert_almost_equal(secs, 40, places=5) + assert hrs == 12 + assert mins == 45 + assert secs == pytest.approx(40, 0.00001) @@ -567,8 +564,8 @@ def test_rise_set(self): the_date = self.date.replace(hour=0, minute=0, second=0, microsecond=0) transit_time = the_date + transit - assert_equal(transit_time.hour, exp_t_hr) - assert_equal(transit_time.minute, exp_t_min) + assert transit_time.hour == exp_t_hr + assert transit_time.minute == exp_t_min msg = '%r !> %r' % (transit_time.second, exp_secs) assert transit_time.second >= exp_secs, msg @@ -579,8 +576,8 @@ def test_rise_set(self): rise_time = the_date + rise - assert_equal(rise_time.hour, exp_r_hr) - assert_equal(rise_time.minute, exp_r_min) + assert rise_time.hour == exp_r_hr + assert rise_time.minute == exp_r_min assert rise_time.second >= exp_secs, '%r !> %r' % (rise_time.second, exp_secs) @@ -590,8 +587,8 @@ def test_rise_set(self): set_time = the_date + sets - assert_equal(set_time.hour, exp_s_hr) - assert_equal(set_time.minute, exp_s_min) + assert set_time.hour == exp_s_hr + assert set_time.minute == exp_s_min assert set_time.second <= exp_secs, '%r !< %r' % (set_time.second, exp_secs) @@ -652,8 +649,8 @@ def test_rise_set(self): transit_time = self.date + transit - assert_equal(transit_time.hour, exp_t_hr) - assert_equal(transit_time.minute, exp_t_min) + assert transit_time.hour == exp_t_hr + assert transit_time.minute == exp_t_min msg = '%r !> %r' % (transit_time.second, exp_secs) assert transit_time.second <= exp_secs, msg @@ -664,8 +661,8 @@ def test_rise_set(self): rise_time = self.date + rise - assert_equal(rise_time.hour, exp_r_hr) - assert_equal(rise_time.minute, exp_r_min) + assert rise_time.hour == exp_r_hr + assert rise_time.minute == exp_r_min assert rise_time.second <= exp_secs, '%r !> %r' % (rise_time.second, exp_secs) @@ -675,8 +672,8 @@ def test_rise_set(self): set_time = self.date + sets - assert_equal(set_time.hour, exp_s_hr) - assert_equal(set_time.minute, exp_s_min) + assert set_time.hour == exp_s_hr + assert set_time.minute == exp_s_min assert set_time.second <= exp_secs, '%r !< %r' % (set_time.second, exp_secs) @@ -707,8 +704,8 @@ def setup_method(self): def test_not_circumpolar(self): - assert(not self.star.is_always_up(self.date)) - assert(not self.star.is_always_down(self.date)) + assert not self.star.is_always_up(self.date) + assert not self.star.is_always_down(self.date) @@ -751,10 +748,10 @@ def setup_method(self): self.date = datetime(year=2010, month=3, day=12) - @raises(RiseSetError) def test_rise_set(self): - (transit, rise, sets) = calc_rise_set(self.canopus, self.st_andrews, - self.date) + with pytest.raises(RiseSetError): + (transit, rise, sets) = calc_rise_set(self.canopus, self.st_andrews, + self.date) def test_star_is_always_down(self): @@ -763,8 +760,8 @@ def test_star_is_always_down(self): self.canopus, horizon = 0.0) - assert(not star.is_always_up(self.date)) - assert(star.is_always_down(self.date)) + assert not star.is_always_up(self.date) + assert star.is_always_down(self.date) @@ -805,10 +802,10 @@ def setup_method(self): self.date = datetime(year=2010, month=3, day=12) - @raises(RiseSetError) def test_rise_set(self): - (transit, rise, sets) = calc_rise_set(self.capella, self.st_andrews, - self.date) + with pytest.raises(RiseSetError): + (transit, rise, sets) = calc_rise_set(self.capella, self.st_andrews, + self.date) def test_star_is_always_up(self): @@ -817,8 +814,8 @@ def test_star_is_always_up(self): self.capella, horizon = 0.0) - assert(star.is_always_up(self.date)) - assert(not star.is_always_down(self.date)) + assert star.is_always_up(self.date) + assert not star.is_always_down(self.date) def test_reducing_horizon_keeps_star_down(self): @@ -827,7 +824,7 @@ def test_reducing_horizon_keeps_star_down(self): self.capella, horizon = 80) - assert(not star.is_always_down(self.date)) + assert not star.is_always_down(self.date) class TestPolarisFromSidingSpring(object): @@ -863,10 +860,10 @@ def setup_method(self): - @raises(RiseSetError) def test_rise_set(self): - (transit, rise, sets) = calc_rise_set(self.polaris, self.siding_spring, - self.date) + with pytest.raises(RiseSetError): + (transit, rise, sets) = calc_rise_set(self.polaris, self.siding_spring, + self.date) @@ -902,10 +899,10 @@ def setup_method(self): self.date = datetime(year=2010, month=3, day=12) - @raises(RiseSetError) def test_rise_set(self): - (transit, rise, sets) = calc_rise_set(self.mimosa, self.siding_spring, - self.date) + with pytest.raises(RiseSetError): + (transit, rise, sets) = calc_rise_set(self.mimosa, self.siding_spring, + self.date) class TestGetAirmassForTarget(object): @@ -936,50 +933,50 @@ def test_get_airmass_for_target_1_ogg(self): airmasses = calculate_airmass_at_times([time], self.target_1, self.ogg_latitude, self.ogg_longitude, self.ogg_height) - assert_equal(1, len(airmasses)) - assert_almost_equal(2.50, airmasses[0], 2) + assert 1 == len(airmasses) + assert 2.50 == pytest.approx(airmasses[0], 0.01) def test_get_airmass_for_target_1_cpt_fail(self): time = datetime(2016, 5, 20, 23, 12, 32, 247312) airmasses = calculate_airmass_at_times([time], self.target_1, self.cpt_latitude, self.cpt_longitude, self.cpt_height) - assert_equal(1, len(airmasses)) + assert 1 == len(airmasses) # assert airmass is so high its not visible - assert_greater(airmasses[0], 10) + assert airmasses[0] > 10 def test_get_airmass_for_target_2_ogg(self): time = datetime(2016, 5, 20, 20, 12, 32, 247312) airmasses = calculate_airmass_at_times([time], self.target_2, self.ogg_latitude, self.ogg_longitude, self.ogg_height) - assert_equal(1, len(airmasses)) - assert_almost_equal(1.33, airmasses[0], 2) + assert 1 == len(airmasses) + assert 1.33 == pytest.approx(airmasses[0], 0.01) def test_get_airmass_for_target_2_ogg_fail(self): time = datetime(2016, 5, 20, 10, 12, 32, 247312) airmasses = calculate_airmass_at_times([time], self.target_2, self.ogg_latitude, self.ogg_longitude, self.ogg_height) - assert_equal(1, len(airmasses)) + assert 1 == len(airmasses) # assert airmass is so high its not visible - assert_greater(airmasses[0], 10) + assert airmasses[0] > 10 def test_get_airmass_for_target_2_cpt(self): time = datetime(2016, 5, 20, 11, 12, 32, 247312) airmasses = calculate_airmass_at_times([time], self.target_2, self.cpt_latitude, self.cpt_longitude, self.cpt_height) - assert_equal(1, len(airmasses)) - assert_almost_equal(1.52, airmasses[0], 2) + assert 1 == len(airmasses) + assert 1.52 == pytest.approx(airmasses[0], 0.01) def test_get_airmass_for_target_3_cpt(self): time = datetime(2016, 5, 20, 3, 12, 32, 247312) airmasses = calculate_airmass_at_times([time], self.target_3, self.cpt_latitude, self.cpt_longitude, self.cpt_height) - assert_equal(1, len(airmasses)) - assert_almost_equal(1.52, airmasses[0], 2) + assert 1 == len(airmasses) + assert 1.52 == pytest.approx(airmasses[0], 0.01) class TestCalculateMoonphase(object): @@ -1035,15 +1032,15 @@ def setup_method(self): def test_calculate_moon_phase(self): moon_phase_1 = calculate_moon_phase(self.start_date, self.ogg_latitude.in_radians(), self.ogg_longitude.in_radians()) - assert_almost_equal(moon_phase_1, self.ogg_moon_phase_groundtruth[0] / 100.0, 2) + assert moon_phase_1 == pytest.approx(self.ogg_moon_phase_groundtruth[0] / 100.0, 0.01) moon_phase_2 = calculate_moon_phase(self.end_date, self.ogg_latitude.in_radians(), self.ogg_longitude.in_radians()) - assert_almost_equal(moon_phase_2, self.ogg_moon_phase_groundtruth[-1] / 100.0, 2) + assert moon_phase_2 == pytest.approx(self.ogg_moon_phase_groundtruth[-1] / 100.0, 0.01) def test_calculate_moon_phase_list(self): moon_phases = calculate_moon_phase_at_times(self.times, self.ogg_latitude, self.ogg_longitude) for i, moon_phase in enumerate(moon_phases): - assert_almost_equal(moon_phase, self.ogg_moon_phase_groundtruth[i] / 100.0, 2) + assert moon_phase == pytest.approx(self.ogg_moon_phase_groundtruth[i] / 100.0, 0.01) def test_moon_phase_similar_between_sites(self): time = self.start_date @@ -1057,4 +1054,4 @@ def test_moon_phase_similar_between_sites(self): for i, moon_phase in enumerate(ogg_moon_phases): # Ensure that the difference never exceeds 2% between cpt and ogg over a year - assert_less(abs(moon_phase - cpt_moon_phases[i]), 0.02) + assert abs(moon_phase - cpt_moon_phases[i]) < 0.02 diff --git a/test/moving_objects_test.py b/test/moving_objects_test.py index 725fb5b..feb30e6 100644 --- a/test/moving_objects_test.py +++ b/test/moving_objects_test.py @@ -31,8 +31,7 @@ from rise_set.astrometry import elem_to_topocentric_apparent from datetime import datetime, timedelta -from nose.tools import (assert_equal, assert_almost_equal, assert_raises, - assert_false, assert_true) +import pytest from mock import patch @@ -81,7 +80,7 @@ def test_can_add_new_site(self): self.sites.add_site(self.site_dict1) self.sites.add_site(self.site_dict2) - assert_equal(self.sites.sites, expected) + assert self.sites.sites == expected def test_can_add_new_sites(self): @@ -92,7 +91,7 @@ def test_can_add_new_sites(self): self.sites.add_sites([self.site_dict1, self.site_dict2]) - assert_equal(self.sites.sites, expected) + assert self.sites.sites == expected def test_cant_add_same_site_coords_again(self): @@ -103,20 +102,20 @@ def test_cant_add_same_site_coords_again(self): self.sites.add_site(self.site_dict1) self.sites.add_site(self.site_dict3) - assert_equal(self.sites.sites, expected) + assert self.sites.sites == expected def test_can_get_site(self): self.sites.add_site(self.site_dict1) received = self.sites.get(self.site_dict1['name']) - assert_equal(received, self.site_dict1) + assert received == self.site_dict1 def test_none_if_no_site_found(self): received = self.sites.get(self.site_dict1['name']) - assert_equal(received, None) + assert received == None def test_initialise_sites(self): @@ -124,8 +123,8 @@ def test_initialise_sites(self): '1m0a.doma.cpt', '1m0a.doma.lsc']) sites = initialise_sites('test/telescopes.dat') - assert_equal(len(sites.sites), 4) - assert_equal(set(sites.sites.keys()), expected_keys) + assert len(sites.sites) == 4 + assert set(sites.sites.keys()) == expected_keys @@ -221,23 +220,23 @@ def setup_method(self): def test_is_moving_object_defaults_to_extra_solar_objects(self): target = {} - assert_false(is_moving_object(target)) + assert not is_moving_object(target) def test_is_moving_object_understands_planets(self): target = {'type' : 'MPC_MINOR_PLANET'} - assert_true(is_moving_object(target)) + assert is_moving_object(target) def test_is_moving_object_understands_comets(self): target = {'type' : 'MPC_MINOR_PLANET'} - assert_true(is_moving_object(target)) + assert is_moving_object(target) def test_is_moving_object_is_case_insensitive(self): target = {'type' : 'MpC_MiNoR_PlAnEt'} - assert_true(is_moving_object(target)) + assert is_moving_object(target) def test_is_moving_object_other_types_dont_move(self): target = {'type' : 'TIMS_CAT'} - assert_false(is_moving_object(target)) + assert not is_moving_object(target) def test_read_neocp_orbit1(self): @@ -264,7 +263,7 @@ def test_read_neocp_orbit1(self): recieved = read_neocp_orbit('test/P109rXK.neocp') for e in list(expected.keys()): - assert_equal(expected[e], recieved[e]) + assert expected[e] == recieved[e] def test_read_neocp_orbit2(self): @@ -292,7 +291,7 @@ def test_read_neocp_orbit2(self): recieved = read_neocp_orbit('test/2013TL117.neocp') for e in list(expected.keys()): - assert_equal(expected[e], recieved[e]) + assert expected[e] == recieved[e] def test_read_neocp_orbit3(self): @@ -322,7 +321,7 @@ def test_read_neocp_orbit3(self): recieved = read_neocp_orbit('test/00001_Ceres.neocp') for e in list(expected.keys()): - assert_equal(expected[e], recieved[e]) + assert expected[e] == recieved[e] @@ -355,7 +354,7 @@ def test_read_neocp_orbit4(self): recieved = read_neocp_orbit('test/LSCTLF3.neocp') for e in list(expected.keys()): - assert_equal(expected[e], recieved[e]) + assert expected[e] == recieved[e] @@ -388,7 +387,7 @@ def test_read_neocp_orbit5(self): recieved = read_neocp_orbit('test/LSCTLF3_V2.neocp') for e in list(expected.keys()): - assert_equal(expected[e], recieved[e]) + assert expected[e] == recieved[e] @@ -419,7 +418,7 @@ def test_read_neocp_orbit6(self): recieved = read_neocp_orbit('test/N007rdx.neocp') for e in list(expected.keys()): - assert_equal(expected[e], recieved[e]) + assert expected[e] == recieved[e] def test_read_neocp_orbit7(self): @@ -449,7 +448,7 @@ def test_read_neocp_orbit7(self): recieved = read_neocp_orbit('test/N007rdx.neocp') for e in list(expected.keys()): - assert_equal(expected[e], recieved[e]) + assert expected[e] == recieved[e] def test_read_neocp_comet_orbit1(self): @@ -476,7 +475,7 @@ def test_read_neocp_comet_orbit1(self): recieved = read_neocp_orbit('test/Comet_SidingSpring.neocp') for e in list(expected.keys()): - assert_equal(expected[e], recieved[e]) + assert expected[e] == recieved[e] def test_read_neocp_comet_orbit2(self): @@ -502,7 +501,7 @@ def test_read_neocp_comet_orbit2(self): recieved = read_neocp_orbit('test/Comet_299P.neocp') for e in list(expected.keys()): - assert_equal(expected[e], recieved[e]) + assert expected[e] == recieved[e] def test_elem_to_topocentric_apparent_time1(self): dt = datetime(2013, 12, 9) @@ -512,8 +511,8 @@ def test_elem_to_topocentric_apparent_time1(self): # Coordinates of (470) Kilia from JPL Horizons: 284.70994 -18.19420 - assert_almost_equal(ra.in_degrees(), 284.70994, places=2) - assert_almost_equal(dec.in_degrees(), -18.19420, places=4) + assert ra.in_degrees() == pytest.approx(284.70994, 0.01) + assert dec.in_degrees() == pytest.approx(-18.19420, 0.0001) def test_elem_to_topocentric_apparent_time2(self): @@ -524,19 +523,20 @@ def test_elem_to_topocentric_apparent_time2(self): # Coordinates from JPL Horizons: 225.22256 -5.29589 - assert_almost_equal(ra.in_degrees(), 225.22256, places=2) - assert_almost_equal(dec.in_degrees(), -5.29589, places=2) + assert ra.in_degrees() == pytest.approx(225.22256, 0.01) + assert dec.in_degrees() == pytest.approx(-5.29589, 0.01) def test_elem_to_topocentric_apparent_bad_eccen(self): dt = datetime(2014, 6, 14) tdb = dt - timedelta(seconds=67.184) - assert_raises(MovingViolation, elem_to_topocentric_apparent, tdb, self.elements2, self.elp) + with pytest.raises(MovingViolation): + elem_to_topocentric_apparent(tdb, self.elements2, self.elp) try: ra, dec = elem_to_topocentric_apparent(tdb, self.elements2, self.elp) except MovingViolation as e: - assert_equal(str(e), 'Error: -2 (illegal eccentricity)') + assert str(e) == 'Error: -2 (illegal eccentricity)' else: assert False, "Didn't raise expected MovingViolation error" @@ -545,11 +545,12 @@ def test_elem_to_topocentric_apparent_bad_meandist(self): dt = datetime(2014, 6, 14) tdb = dt - timedelta(seconds=67.184) - assert_raises(MovingViolation, elem_to_topocentric_apparent, tdb, self.elements3, self.elp) + with pytest.raises(MovingViolation): + elem_to_topocentric_apparent(tdb, self.elements3, self.elp) try: ra, dec = elem_to_topocentric_apparent(tdb, self.elements3, self.elp) except MovingViolation as e: - assert_equal(str(e), 'Error: -3 (illegal mean distance)') + assert str(e) == 'Error: -3 (illegal mean distance)' else: assert False, "Didn't raise expected MovingViolation error" @@ -558,11 +559,12 @@ def test_elem_to_topocentric_apparent_bad_jform(self): dt = datetime(2014, 6, 14) tdb = dt - timedelta(seconds=67.184) - assert_raises(MovingViolation, elem_to_topocentric_apparent, tdb, self.comet_elements1, self.elp, 42) + with pytest.raises(MovingViolation): + elem_to_topocentric_apparent(tdb, self.comet_elements1, self.elp, 42) try: ra, dec = elem_to_topocentric_apparent(tdb, self.comet_elements1, self.elp, 42) except MovingViolation as e: - assert_equal(str(e), 'Error: -1 (illegal JFORM)') + assert str(e) == 'Error: -1 (illegal JFORM)' else: assert False, "Didn't raise expected MovingViolation error" @@ -575,8 +577,8 @@ def test_elem_to_topocentric_apparent_comet1(self): # Coordinates from JPL Horizons: 153.36306 36.46146 - assert_almost_equal(ra.in_degrees(), 153.36306, places=2) - assert_almost_equal(dec.in_degrees(), 36.46146, places=2) + assert ra.in_degrees() == pytest.approx(153.36306, 0.01) + assert dec.in_degrees() == pytest.approx(36.46146, 0.01) def test_elem_to_topocentric_apparent_comet2(self): @@ -587,8 +589,8 @@ def test_elem_to_topocentric_apparent_comet2(self): # Coordinates from JPL Horizons: 37.78519 -31.04102 - assert_almost_equal(ra.in_degrees(), 37.78519, places=4) - assert_almost_equal(dec.in_degrees(),-31.04102, places=4) + assert ra.in_degrees() == pytest.approx(37.78519, 0.0001) + assert dec.in_degrees() == pytest.approx(-31.04102, 0.0001) def test_calc_ephemerides(self): @@ -635,10 +637,10 @@ def test_calc_ephemerides(self): received = calc_ephemerides(window, self.elements, self.cpt, chunk_size) for e, r in zip(expected, received): - assert_almost_equal(e['ra_app'].in_degrees(), r['ra_app'].in_degrees(), places=3) - assert_almost_equal(e['dec_app'].in_degrees(), r['dec_app'].in_degrees(), places=4) - assert_equal(e['start'], r['start']) - assert_equal(e['end'], r['end']) + assert e['ra_app'].in_degrees() == pytest.approx(r['ra_app'].in_degrees(), 0.001) + assert e['dec_app'].in_degrees() == pytest.approx(r['dec_app'].in_degrees(), 0.0001) + assert e['start'] == r['start'] + assert e['end'] == r['end'] def test_find_moving_object_up_intervals1(self): @@ -668,14 +670,14 @@ def test_find_moving_object_up_intervals1(self): self.elements, self.cpt, chunk_size) - assert_equal(len(expected_intervals), len(received_ints)) - assert_equal(len(expected_altitudes), len(received_alts)) + assert len(expected_intervals) == len(received_ints) + assert len(expected_altitudes) == len(received_alts) for e, r in zip(expected_intervals, received_ints): - assert_equal(e, r) + assert e == r for e, r in zip(expected_altitudes, received_alts): - assert_almost_equal(e.in_degrees(), r.in_degrees(), places=3) + assert e.in_degrees() == pytest.approx(r.in_degrees(), 0.001) def test_find_moving_object_up_intervals2(self): @@ -706,14 +708,14 @@ def test_find_moving_object_up_intervals2(self): self.elements, self.cpt, chunk_size) - assert_equal(len(expected_intervals), len(received_ints)) - assert_equal(len(expected_altitudes), len(received_alts)) + assert len(expected_intervals) == len(received_ints) + assert len(expected_altitudes) == len(received_alts) for e, r in zip(expected_intervals, received_ints): - assert_equal(e, r) + assert e == r for e, r in zip(expected_altitudes, received_alts): - assert_almost_equal(e.in_degrees(), r.in_degrees(), places=3) + assert e.in_degrees() == pytest.approx(r.in_degrees(), 0.001) def test_find_moving_object_up_intervals3(self): @@ -749,14 +751,14 @@ def test_find_moving_object_up_intervals3(self): self.elements, self.cpt, chunk_size) - assert_equal(len(expected_intervals), len(received_ints)) - assert_equal(len(expected_altitudes), len(received_alts)) + assert len(expected_intervals) == len(received_ints) + assert len(expected_altitudes) == len(received_alts) for e, r in zip(expected_intervals, received_ints): - assert_equal(e, r) + assert e == r for e, r in zip(expected_altitudes, received_alts): - assert_almost_equal(e.in_degrees(), r.in_degrees(), places=3) + assert e.in_degrees() == pytest.approx(r.in_degrees(), 0.001) @patch('rise_set.moving_objects.calc_ephemerides') @@ -768,7 +770,7 @@ def test_find_moving_object_sets_asteroid_jform(self, alt_mock, ha_mock, elements = {'type' : 'MPC_MINOR_PLANET'} site = None find_moving_object_up_intervals(window, elements, site) - assert_equal(ephem_mock.call_args[0][4], 2) + assert ephem_mock.call_args[0][4] == 2 @patch('rise_set.moving_objects.calc_ephemerides') @@ -791,7 +793,7 @@ def test_find_moving_object_invalid_type_raises_exception(self): try: find_moving_object_up_intervals(window, elements, site) except MovingViolation as e: - assert_equal(str(e), "Unsupported target type: 'tims_cat'") + assert str(e) == "Unsupported target type: 'tims_cat'" else: assert False, "Didn't raise expected MovingViolation error" @@ -801,7 +803,7 @@ def test_hour_angle_beyond_neg_limit(self): neg_limit = Angle(degrees=-4.6*self.HOURS_TO_DEGREES) pos_limit = Angle(degrees=4.6*self.HOURS_TO_DEGREES) - assert_equal(hour_angle_within_limits(ha, neg_limit, pos_limit), False) + assert not hour_angle_within_limits(ha, neg_limit, pos_limit) def test_hour_angle_beyond_pos_limit(self): @@ -809,7 +811,7 @@ def test_hour_angle_beyond_pos_limit(self): neg_limit = Angle(degrees=-4.6*self.HOURS_TO_DEGREES) pos_limit = Angle(degrees=4.6*self.HOURS_TO_DEGREES) - assert_equal(hour_angle_within_limits(ha, neg_limit, pos_limit), False) + assert not hour_angle_within_limits(ha, neg_limit, pos_limit) def test_hour_angle_within_limits(self): @@ -817,7 +819,7 @@ def test_hour_angle_within_limits(self): neg_limit = Angle(degrees=-4.6*self.HOURS_TO_DEGREES) pos_limit = Angle(degrees=4.6*self.HOURS_TO_DEGREES) - assert_equal(hour_angle_within_limits(ha, neg_limit, pos_limit), True) + assert hour_angle_within_limits(ha, neg_limit, pos_limit) def test_ephemeris_chunk_within_ha_limits(self): @@ -826,7 +828,7 @@ def test_ephemeris_chunk_within_ha_limits(self): neg_limit = Angle(degrees=-4.6*self.HOURS_TO_DEGREES) pos_limit = Angle(degrees=4.6*self.HOURS_TO_DEGREES) - assert_equal(ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit), True) + assert ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit) def test_ephemeris_chunk_partially_outside_positive_ha_limit(self): @@ -835,7 +837,7 @@ def test_ephemeris_chunk_partially_outside_positive_ha_limit(self): neg_limit = Angle(degrees=-4.6*self.HOURS_TO_DEGREES) pos_limit = Angle(degrees=4.6*self.HOURS_TO_DEGREES) - assert_equal(ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit), False) + assert not ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit) def test_ephemeris_chunk_fully_outside_positive_ha_limit(self): @@ -844,7 +846,7 @@ def test_ephemeris_chunk_fully_outside_positive_ha_limit(self): neg_limit = Angle(degrees=-4.6*self.HOURS_TO_DEGREES) pos_limit = Angle(degrees=4.6*self.HOURS_TO_DEGREES) - assert_equal(ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit), False) + assert not ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit) def test_ephemeris_chunk_partially_outside_negative_ha_limit(self): @@ -853,7 +855,7 @@ def test_ephemeris_chunk_partially_outside_negative_ha_limit(self): neg_limit = Angle(degrees=-4.6*self.HOURS_TO_DEGREES) pos_limit = Angle(degrees=4.6*self.HOURS_TO_DEGREES) - assert_equal(ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit), False) + assert not ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit) def test_ephemeris_chunk_fully_outside_negative_ha_limit(self): @@ -862,7 +864,7 @@ def test_ephemeris_chunk_fully_outside_negative_ha_limit(self): neg_limit = Angle(degrees=-4.6*self.HOURS_TO_DEGREES) pos_limit = Angle(degrees=4.6*self.HOURS_TO_DEGREES) - assert_equal(ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit), False) + assert not ephemeris_chunk_within_ha_limits(ha1, ha2, neg_limit, pos_limit) def test_ephemeris_chunk_fully_above_horizon(self): @@ -870,7 +872,7 @@ def test_ephemeris_chunk_fully_above_horizon(self): alt2 = Angle(degrees=21) horizon = Angle(degrees=15) - assert_equal(ephemeris_chunk_above_horizon(alt1, alt2, horizon), True) + assert ephemeris_chunk_above_horizon(alt1, alt2, horizon) def test_ephemeris_chunk_partially_above_horizon(self): @@ -878,7 +880,7 @@ def test_ephemeris_chunk_partially_above_horizon(self): alt2 = Angle(degrees=16) horizon = Angle(degrees=15) - assert_equal(ephemeris_chunk_above_horizon(alt1, alt2, horizon), False) + assert not ephemeris_chunk_above_horizon(alt1, alt2, horizon) def test_ephemeris_chunk_below_horizon(self): @@ -886,7 +888,7 @@ def test_ephemeris_chunk_below_horizon(self): alt2 = Angle(degrees=11) horizon = Angle(degrees=15) - assert_equal(ephemeris_chunk_above_horizon(alt1, alt2, horizon), False) + assert not ephemeris_chunk_above_horizon(alt1, alt2, horizon) @patch('rise_set.moving_objects.calc_ephemerides') @@ -928,7 +930,7 @@ def test_moving_objects_respect_negative_hour_angle_limit(self, alt_mock, received_ints, received_alts = find_moving_object_up_intervals(window, elements, site_dict, chunk_size) - assert_equal(received_ints, []) + assert received_ints == [] def test_find_moving_object_network_up_intervals(self): @@ -962,8 +964,7 @@ def test_find_moving_object_network_up_intervals(self): site_filename, chunk_size) for site in list(expected.keys()): - print(site) - assert_equal(expected[site], received[site]) + assert expected[site] == received[site] def test_chunk_windows(self): @@ -996,7 +997,7 @@ def test_chunk_windows(self): received = chunk_windows(window, chunk_size) - assert_equal(received, expected) + assert received == expected def test_chunk_windows_span_ut_boundary(self): @@ -1029,7 +1030,7 @@ def test_chunk_windows_span_ut_boundary(self): received = chunk_windows(window, chunk_size) - assert_equal(received, expected) + assert received == expected def test_special_neo_target(self): @@ -1078,5 +1079,4 @@ def test_special_neo_target(self): for site in list(expected.keys()): - print(site) - assert_equal(expected[site], received[site]) + assert expected[site] == received[site] diff --git a/test/nosey_test.py b/test/nosey_test.py index cc8482e..89a2bfb 100644 --- a/test/nosey_test.py +++ b/test/nosey_test.py @@ -5,12 +5,11 @@ import rise_set.angle as angle from math import pi -from nose.tools import eq_ def test_from_degrees(): a = angle.Angle(degrees = 0) a.from_degrees(37) - eq_(a.in_degrees(), 37) + assert a.in_degrees() == 37 @@ -22,9 +21,9 @@ def setup(self): def test_from_degrees(self): self.angle.from_degrees(37) - eq_(self.angle.in_degrees(), 37) + assert self.angle.in_degrees() == 37 def test_from_radians(self): self.angle.from_radians(pi) - eq_(self.angle.in_degrees(), 180) + assert self.angle.in_degrees() == 180 diff --git a/test/rates_test.py b/test/rates_test.py index 0dfd6ed..9761702 100644 --- a/test/rates_test.py +++ b/test/rates_test.py @@ -3,7 +3,7 @@ from __future__ import division from builtins import object -from nose.tools import assert_equal, assert_almost_equal, raises +import pytest from math import pi #Import the module to test @@ -15,10 +15,10 @@ class TestProperMotion(object): '''Unit tests for the ProperMotion object.''' #Test that conifg errors are raised if wrong key words are inputted - @raises(RatesConfigError) def test_configuration(self): - ra = RightAscension(degrees = 90) - proper_motion = ProperMotion(ra, time = 'millennia') + with pytest.raises(RatesConfigError): + ra = RightAscension(degrees = 90) + proper_motion = ProperMotion(ra, time = 'millennia') @@ -27,27 +27,27 @@ def test_configuration(self): def test_in_degrees_per_year_ra_deg_milliarcseconds(self): ra = RightAscension(degrees = '0 0 0.001') proper_motion = ProperMotion(ra) - assert_almost_equal(proper_motion.in_degrees_per_year(), 2.77778e-07, 5) + assert proper_motion.in_degrees_per_year() == pytest.approx(2.77778e-07, 0.00001) def test_in_radians_per_year_ra_deg_arc(self): ra = RightAscension(degrees = 90) proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_radians_per_year(), pi/2) + assert proper_motion.in_radians_per_year() == pi/2 def test_in_degrees_per_year_ra_deg_arc(self): ra = RightAscension(degrees = 90) proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_degrees_per_year(), 90) + assert proper_motion.in_degrees_per_year() == 90 def test_in_radians_per_century_ra_deg_arc(self): ra = RightAscension(degrees = 90) proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_radians_per_century(), pi/2) + assert proper_motion.in_radians_per_century() == pi/2 def test_in_degrees_per_century_ra_deg_arc(self): ra = RightAscension(degrees = 90) proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_degrees_per_century(), 90) + assert proper_motion.in_degrees_per_century() == 90 @@ -56,22 +56,22 @@ def test_in_degrees_per_century_ra_deg_arc(self): def test_in_radians_per_year_from_century_ra_deg_arc(self): ra = RightAscension(degrees = 90) proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_radians_per_year(), pi/2 / 100 ) + assert proper_motion.in_radians_per_year() == pi/2 / 100 def test_in_degrees_per_year_from_century_ra_deg_arc(self): ra = RightAscension(degrees = 90) proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_degrees_per_year(), 90 / 100) + assert proper_motion.in_degrees_per_year() == 90 / 100 def test_in_radians_per_century_from_year_ra_deg_arc(self): ra = RightAscension(degrees = 90) proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_radians_per_century(), pi/2 * 100) + assert proper_motion.in_radians_per_century() == pi/2 * 100 def test_in_degrees_per_century_from_year_ra_deg_arc(self): ra = RightAscension(degrees = 90) proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_degrees_per_century(), 90 * 100) + assert proper_motion.in_degrees_per_century() == 90 * 100 @@ -80,22 +80,22 @@ def test_in_degrees_per_century_from_year_ra_deg_arc(self): def test_in_radians_per_year_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_radians_per_year(), pi) + assert proper_motion.in_radians_per_year() == pi def test_in_degrees_per_year_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_degrees_per_year(), 180) + assert proper_motion.in_degrees_per_year() == 180 def test_in_radians_per_century_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_radians_per_century(), pi) + assert proper_motion.in_radians_per_century() == pi def test_in_degrees_per_century_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_degrees_per_century(), 180) + assert proper_motion.in_degrees_per_century() == 180 @@ -104,22 +104,22 @@ def test_in_degrees_per_century_ra_time(self): def test_in_radians_per_year_from_century_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_radians_per_year(), pi / 100 ) + assert proper_motion.in_radians_per_year() == pi / 100 def test_in_degrees_per_year_from_century_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_degrees_per_year(), 180 / 100) + assert proper_motion.in_degrees_per_year() == 180 / 100 def test_in_radians_per_century_from_year_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_radians_per_century(), pi * 100) + assert proper_motion.in_radians_per_century() == pi * 100 def test_in_degrees_per_century_from_year_ra_time(self): ra = RightAscension('12:00:00') proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_degrees_per_century(), 180 * 100) + assert proper_motion.in_degrees_per_century() == 180 * 100 @@ -128,22 +128,22 @@ def test_in_degrees_per_century_from_year_ra_time(self): def test_in_radians_per_year_ra_radians(self): ra = RightAscension(radians = pi/2) proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_radians_per_year(), pi/2) + assert proper_motion.in_radians_per_year() == pi/2 def test_in_degrees_per_year_ra_radians(self): ra = RightAscension(radians = pi/2) proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_degrees_per_year(), 90) + assert proper_motion.in_degrees_per_year() == 90 def test_in_radians_per_century_ra_radians(self): ra = RightAscension(radians = pi/2) proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_radians_per_century(), pi/2) + assert proper_motion.in_radians_per_century() == pi/2 def test_in_degrees_per_century_ra_radians(self): ra = RightAscension(radians = pi/2) proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_degrees_per_century(), 90) + assert proper_motion.in_degrees_per_century() == 90 @@ -152,22 +152,22 @@ def test_in_degrees_per_century_ra_radians(self): def test_in_radians_per_year_from_century_ra_radians(self): ra = RightAscension(radians = pi/2) proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_radians_per_year(), pi/2 / 100 ) + assert proper_motion.in_radians_per_year() == pi/2 / 100 def test_in_degrees_per_year_from_century_ra_radians(self): ra = RightAscension(radians = pi/2) proper_motion = ProperMotion(ra, time = 'century') - assert_equal(proper_motion.in_degrees_per_year(), 90 / 100) + assert proper_motion.in_degrees_per_year() == 90 / 100 def test_in_radians_per_century_from_year_ra_radians(self): ra = RightAscension(radians = pi/2) proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_radians_per_century(), pi/2 * 100) + assert proper_motion.in_radians_per_century() == pi/2 * 100 def test_in_degrees_per_century_from_year_ra_radians(self): ra = RightAscension(radians = pi/2) proper_motion = ProperMotion(ra) - assert_equal(proper_motion.in_degrees_per_century(), 90 * 100) + assert proper_motion.in_degrees_per_century() == 90 * 100 #_______________________________________________________________________ @@ -176,22 +176,22 @@ def test_in_degrees_per_century_from_year_ra_radians(self): def test_in_radians_per_year_dec_deg_arc(self): dec = Declination(degrees = 90) proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_radians_per_year(), pi/2) + assert proper_motion.in_radians_per_year() == pi/2 def test_in_degrees_per_year_dec_deg_arc(self): dec = Declination(degrees = 90) proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_degrees_per_year(), 90) + assert proper_motion.in_degrees_per_year() == 90 def test_in_radians_per_century_dec_deg_arc(self): dec = Declination(degrees = 90) proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_radians_per_century(), pi/2) + assert proper_motion.in_radians_per_century() == pi/2 def test_in_degrees_per_century_dec_deg_arc(self): dec = Declination(degrees = 90) proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_degrees_per_century(), 90) + assert proper_motion.in_degrees_per_century() == 90 @@ -200,22 +200,22 @@ def test_in_degrees_per_century_dec_deg_arc(self): def test_in_radians_per_year_from_century_dec_deg_arc(self): dec = Declination(degrees = 90) proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_radians_per_year(), pi/2 / 100 ) + assert proper_motion.in_radians_per_year() == pi/2 / 100 def test_in_degrees_per_year_from_century_dec_deg_arc(self): dec = Declination(degrees = 90) proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_degrees_per_year(), 90 / 100) + assert proper_motion.in_degrees_per_year() == 90 / 100 def test_in_radians_per_century_from_year_dec_deg_arc(self): dec = Declination(degrees = 90) proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_radians_per_century(), pi/2 * 100) + assert proper_motion.in_radians_per_century() == pi/2 * 100 def test_in_degrees_per_century_from_year_dec_deg_arc(self): dec = Declination(degrees = 90) proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_degrees_per_century(), 90 * 100) + assert proper_motion.in_degrees_per_century() == 90 * 100 @@ -224,22 +224,22 @@ def test_in_degrees_per_century_from_year_dec_deg_arc(self): def test_in_radians_per_year_dec_time(self): dec = Declination(degrees = 6, units = 'time') proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_radians_per_year(), pi/2) + assert proper_motion.in_radians_per_year() == pi/2 def test_in_degrees_per_year_dec_time(self): dec = Declination(degrees = 6, units = 'time') proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_degrees_per_year(), 90) + assert proper_motion.in_degrees_per_year() == 90 def test_in_radians_per_century_dec_time(self): dec = Declination(degrees = 6, units = 'time') proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_radians_per_century(), pi/2) + assert proper_motion.in_radians_per_century() == pi/2 def test_in_degrees_per_century_dec_time(self): dec = Declination(degrees = 6, units = 'time') proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_degrees_per_century(), 90) + assert proper_motion.in_degrees_per_century() == 90 @@ -248,22 +248,22 @@ def test_in_degrees_per_century_dec_time(self): def test_in_radians_per_year_from_century_dec_time(self): dec = Declination(degrees = 6, units = 'time') proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_radians_per_year(), pi/2 / 100 ) + assert proper_motion.in_radians_per_year() == pi/2 / 100 def test_in_degrees_per_year_from_century_dec_time(self): dec = Declination(degrees = 6, units = 'time') proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_degrees_per_year(), 90 / 100) + assert proper_motion.in_degrees_per_year() == 90 / 100 def test_in_radians_per_century_from_year_dec_time(self): dec = Declination(degrees = 6, units = 'time') proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_radians_per_century(), pi/2 * 100) + assert proper_motion.in_radians_per_century() == pi/2 * 100 def test_in_degrees_per_century_from_year_dec_time(self): dec = Declination(degrees = 6, units = 'time') proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_degrees_per_century(), 90 * 100) + assert proper_motion.in_degrees_per_century() == 90 * 100 @@ -272,22 +272,22 @@ def test_in_degrees_per_century_from_year_dec_time(self): def test_in_radians_per_year_dec_radians(self): dec = Declination(radians = pi/4) proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_radians_per_year(), pi/4) + assert proper_motion.in_radians_per_year() == pi/4 def test_in_degrees_per_year_dec_radians(self): dec = Declination(radians = pi/4) proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_degrees_per_year(), 45) + assert proper_motion.in_degrees_per_year() == 45 def test_in_radians_per_century_dec_radians(self): dec = Declination(radians = pi/4) proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_radians_per_century(), pi/4) + assert proper_motion.in_radians_per_century() == pi/4 def test_in_degrees_per_century_dec_radians(self): dec = Declination(radians = pi/4) proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_degrees_per_century(), 45) + assert proper_motion.in_degrees_per_century() == 45 @@ -296,19 +296,19 @@ def test_in_degrees_per_century_dec_radians(self): def test_in_radians_per_year_from_century_dec_radians(self): dec = Declination(radians = pi/4) proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_radians_per_year(), pi/4 / 100 ) + assert proper_motion.in_radians_per_year() == pi/4 / 100 def test_in_degrees_per_year_from_century_dec_radians(self): dec = Declination(radians = pi/4) proper_motion = ProperMotion(dec, time = 'century') - assert_equal(proper_motion.in_degrees_per_year(), 45 / 100) + assert proper_motion.in_degrees_per_year() == 45 / 100 def test_in_radians_per_century_from_year_dec_radians(self): dec = Declination(radians = pi/4) proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_radians_per_century(), pi/4 * 100) + assert proper_motion.in_radians_per_century() == pi/4 * 100 def test_in_degrees_per_century_from_year_dec_radians(self): dec = Declination(radians = pi/4) proper_motion = ProperMotion(dec) - assert_equal(proper_motion.in_degrees_per_century(), 45 * 100) + assert proper_motion.in_degrees_per_century() == 45 * 100 diff --git a/test/sky_coordinates_test.py b/test/sky_coordinates_test.py index 277692c..a258aad 100644 --- a/test/sky_coordinates_test.py +++ b/test/sky_coordinates_test.py @@ -1,7 +1,7 @@ #!/usr/bin/python from __future__ import division from builtins import object -from nose.tools import raises +import pytest from math import pi @@ -16,42 +16,38 @@ class TestCoordinateSystem(object): from the angle.Angle class''' # Test invalid inputs for RA - @raises(InvalidAngleError) def test_validate_ra_invalid_hr_too_small(self): - self.angle = RightAscension('-12:00:00') + with pytest.raises(InvalidAngleError): + self.angle = RightAscension('-12:00:00') - @raises(InvalidAngleError) def test_validate_ra_invalid_hr_too_big(self): - self.angle = RightAscension('24:00:00') + with pytest.raises(InvalidAngleError): + self.angle = RightAscension('24:00:00') - @raises(InvalidAngleError) def test_validate_ra_invalid_hr_too_big_rad(self): - self.angle = RightAscension(radians = 2*pi) + with pytest.raises(InvalidAngleError): + self.angle = RightAscension(radians = 2*pi) - @raises(InvalidAngleError) def test_validate_ra_invalid_min_too_big(self): - self.angle = RightAscension('23:61:00') - - + with pytest.raises(InvalidAngleError): + self.angle = RightAscension('23:61:00') # Test invalid inputs for Dec - @raises(InvalidAngleError) def test_validate_dec_invalid_deg_too_small(self): - self.angle = Declination(-91) + with pytest.raises(InvalidAngleError): + self.angle = Declination(-91) - @raises(InvalidAngleError) def test_validate_dec_invalid_deg_too_big(self): - self.angle = Declination(degrees = 91) + with pytest.raises(InvalidAngleError): + self.angle = Declination(degrees = 91) - @raises(InvalidAngleError) def test_validate_dec_invalid_deg_too_big_rad(self): - self.angle = Declination(radians = pi) + with pytest.raises(InvalidAngleError): + self.angle = Declination(radians = pi) - @raises(InvalidAngleError) def test_validate_dec_invalid_min_too_big(self): - self.angle = Declination(degrees = '89:61:00') - - + with pytest.raises(InvalidAngleError): + self.angle = Declination(degrees = '89:61:00') # Test valid inputs for RA def test_validate_ra_valid_at_zero_degrees(self): diff --git a/test/test_utils.py b/test/test_utils.py index cfd86e1..7e1f0f1 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -14,7 +14,6 @@ intersect_many_intervals, inverse_intervals) import datetime -from nose.tools import assert_equal class TestUtils(object): @@ -59,10 +58,10 @@ def test_coalesce_adjacent_intervals(self): input_intervals = list(self.some_adjacent_intervals) received = coalesce_adjacent_intervals(self.some_adjacent_intervals) - assert_equal(received, self.expected_coalescence) + assert received == self.expected_coalescence # Confirm the input list was not modified in place - assert_equal(input_intervals, self.some_adjacent_intervals) + assert input_intervals == self.some_adjacent_intervals def test_intersect_case01(self): @@ -74,7 +73,7 @@ def test_intersect_case01(self): int2 = [(datetime.datetime(2013, 6, 15, 0, 0, 0), datetime.datetime(2013, 6, 15, 3, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_case02(self): @@ -86,7 +85,7 @@ def test_intersect_case02(self): int2 = [(datetime.datetime(2013, 6, 15, 9, 0, 0), datetime.datetime(2013, 6, 15, 14, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_case03(self): @@ -98,7 +97,7 @@ def test_intersect_case03(self): int2 = [(datetime.datetime(2013, 6, 15, 13, 0, 0), datetime.datetime(2013, 6, 15, 14, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_case04(self): @@ -110,7 +109,7 @@ def test_intersect_case04(self): int2 = [(datetime.datetime(2013, 6, 15, 13, 0, 0), datetime.datetime(2013, 6, 15, 16, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_case05(self): @@ -122,7 +121,7 @@ def test_intersect_case05(self): int2 = [(datetime.datetime(2013, 6, 15, 16, 0, 0), datetime.datetime(2013, 6, 15, 18, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_case06(self): @@ -134,7 +133,7 @@ def test_intersect_case06(self): int2 = [(datetime.datetime(2013, 6, 15, 11, 0, 0), datetime.datetime(2013, 6, 15, 16, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected ## Edge cases ## @@ -147,7 +146,7 @@ def test_intersect_case07(self): int2 = [(datetime.datetime(2013, 6, 15, 12, 0, 0), datetime.datetime(2013, 6, 15, 15, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_case08(self): @@ -159,7 +158,7 @@ def test_intersect_case08(self): int2 = [(datetime.datetime(2013, 6, 15, 9, 0, 0), datetime.datetime(2013, 6, 15, 12, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_case09(self): @@ -171,7 +170,7 @@ def test_intersect_case09(self): int2 = [(datetime.datetime(2013, 6, 15, 15, 0, 0), datetime.datetime(2013, 6, 15, 18, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_case10(self): @@ -183,7 +182,7 @@ def test_intersect_case10(self): int2 = [(datetime.datetime(2013, 6, 15, 12, 0, 0), datetime.datetime(2013, 6, 15, 16, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_case11(self): # case 11 |......| @@ -194,7 +193,7 @@ def test_intersect_case11(self): int2 = [(datetime.datetime(2013, 6, 15, 11, 0, 0), datetime.datetime(2013, 6, 15, 15, 0, 0))] received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected ## Multiple intersections @@ -210,7 +209,7 @@ def test_intersect_case12(self): received = intersect_intervals(int1, int2) - assert_equal(received, expected) + assert received == expected def test_intersect_many(self): @@ -224,7 +223,7 @@ def test_intersect_many(self): int3 = [(datetime.datetime(2013, 6, 15, 14, 0, 0), datetime.datetime(2013, 6, 15, 17, 0, 0))] received = intersect_many_intervals(int1,int2,int3) - assert_equal(received,expected) + assert received == expected def test_inverse_intervals_outside_bound(self): @@ -233,7 +232,7 @@ def test_inverse_intervals_outside_bound(self): intervals = [(datetime.datetime(2013, 6, 15, 9), datetime.datetime(2013, 6, 15, 11)), (datetime.datetime(2013, 6, 15, 15, 30), datetime.datetime(2013, 6, 15, 17))] inverse = inverse_intervals(intervals, start_bound, end_bound) expected_intervals = [(start_bound, intervals[0][0]), (intervals[0][1], intervals[1][0]), (intervals[1][1], end_bound)] - assert_equal(inverse, expected_intervals) + assert inverse == expected_intervals def test_inverse_intervals_inside_bound_between_intervals(self): @@ -242,7 +241,7 @@ def test_inverse_intervals_inside_bound_between_intervals(self): intervals = [(datetime.datetime(2013, 6, 14, 9), datetime.datetime(2013, 6, 15, 11)), (datetime.datetime(2013, 6, 15, 15, 30), datetime.datetime(2013, 6, 16, 17))] inverse = inverse_intervals(intervals, start_bound, end_bound) expected_intervals = [(intervals[0][1], intervals[1][0])] - assert_equal(inverse, expected_intervals) + assert inverse == expected_intervals def test_inverse_intervals_inside_bound_within_intervals(self): @@ -254,4 +253,4 @@ def test_inverse_intervals_inside_bound_within_intervals(self): ] inverse = inverse_intervals(intervals, start_bound, end_bound) expected_intervals = [(start_bound, intervals[1][0]), (intervals[1][1], intervals[2][0]), (intervals[2][1], end_bound)] - assert_equal(inverse, expected_intervals) + assert inverse == expected_intervals diff --git a/test/visibility_test.py b/test/visibility_test.py index 0e4da3b..6555963 100644 --- a/test/visibility_test.py +++ b/test/visibility_test.py @@ -4,7 +4,7 @@ from builtins import range from builtins import object -from nose.tools import assert_equal, assert_almost_equals, assert_less, raises +import pytest from datetime import datetime, timedelta #Import the module to test @@ -127,7 +127,7 @@ def test_dark_intervals_have_positive_duration(self): # dark_intervals = visibility._find_when_target_is_up('sun', dt=datetime(2014, 3, 20)) for start, end in dark_intervals: - assert_less(start, end) + assert start < end def test_can_get_sun_up_intervals(self): @@ -172,7 +172,7 @@ def test_can_get_sun_down_intervals(self): # Ignore microseconds for these tests received = zero_out_microseconds(received) - assert_equal(received, expected) + assert received == expected def test_sun_down_intervals_have_positive_duration(self): @@ -192,7 +192,7 @@ def test_sun_down_intervals_have_positive_duration(self): received = visibility._find_when_target_is_down(self.sun, dt, star=None, airmass=None) - assert_less(received[0][0], received[0][1]) + assert received[0][0] < received[0][1] @@ -214,7 +214,7 @@ def test_can_get_dark_intervals(self): # Ignore microseconds for these tests received = zero_out_microseconds(received) - assert_equal(received, expected) + assert received == expected def test_get_target_intervals_ra_dec(self): @@ -239,8 +239,7 @@ def test_get_target_intervals_ra_dec(self): # Ignore microseconds for these tests received = zero_out_microseconds(received) - assert_equal(received, expected) - + assert received == expected @patch('rise_set.visibility.Visibility._get_ra_target_intervals') @patch('rise_set.visibility.Visibility._get_moving_object_target_intervals') @@ -249,9 +248,8 @@ def test_get_target_intervals_no_target_specified(self, mock_func1, mock_func2): received = self.visibility.get_target_intervals(target) - assert_equal(mock_func1.call_count, 0) - assert_equal(mock_func2.call_count, 1) - + assert mock_func1.call_count == 0 + assert mock_func2.call_count == 1 def test_get_target_intervals_satellite_target(self): target = make_satellite_target(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) @@ -259,7 +257,7 @@ def test_get_target_intervals_satellite_target(self): target_intervals = self.visibility.get_target_intervals(target) dark_intervals = self.visibility.get_dark_intervals() - assert_equal(target_intervals, dark_intervals) + assert target_intervals == dark_intervals def test_get_target_intervals_hour_angle_target(self): target = make_hour_angle_target(0.0, 0.0, 0.0, 0.0, 0.0, 0.0) @@ -267,7 +265,7 @@ def test_get_target_intervals_hour_angle_target(self): target_intervals = self.visibility.get_target_intervals(target) dark_intervals = self.visibility.get_dark_intervals() - assert_equal(target_intervals, dark_intervals) + assert target_intervals == dark_intervals @patch('rise_set.visibility.Visibility._get_ra_target_intervals') @patch('rise_set.visibility.Visibility._get_moving_object_target_intervals') @@ -277,9 +275,8 @@ def test_get_target_intervals_mpc_comet_type_is_a_moving_object(self, moving_obj received = self.visibility.get_target_intervals(target) - assert_equal(moving_obj_func.call_count, 1) - assert_equal(ra_dec_func.call_count, 0) - + assert moving_obj_func.call_count == 1 + assert ra_dec_func.call_count == 0 @patch('rise_set.visibility.find_moving_object_up_intervals') def test_get_target_intervals_mpc_minor_planet_type_gets_correct_intervals(self, mock_func): @@ -298,7 +295,7 @@ def test_get_target_intervals_mpc_minor_planet_type_gets_correct_intervals(self, received = self.visibility.get_target_intervals(target) - assert_equal(mock_func.call_count, 1) + assert mock_func.call_count == 1 args, kwargs = mock_func.call_args @@ -313,11 +310,9 @@ def test_get_target_intervals_mpc_minor_planet_type_gets_correct_intervals(self, 'longitude': Angle(degrees=-119.863045833) } - assert_equal(args[0], expected_window) - assert_equal(args[1], expected_target) - assert_equal(args[2], expected_site) - - + assert args[0] == expected_window + assert args[1] == expected_target + assert args[2] == expected_site def test_up_intervals_rise_set_transit_within_same_day(self): start = datetime(year=2011, month=10, day=13, hour=0, minute=30) @@ -625,26 +620,23 @@ def test_ha_ut_mjd_is_truncated(self): ha_limit_pos=site['ha_limit_pos'], ) - assert_equal(v.get_observable_intervals(target, moon_distance=Angle(degrees=0)), []) + assert v.get_observable_intervals(target, moon_distance=Angle(degrees=0)) == [] - - - @raises(InvalidHourAngleLimit) def test_negative_hour_angle_too_big_is_rejected(self): - visibility = Visibility(None, None, None, ha_limit_neg=-13.0) + with pytest.raises(InvalidHourAngleLimit): + visibility = Visibility(None, None, None, ha_limit_neg=-13.0) - @raises(InvalidHourAngleLimit) def test_negative_hour_angle_too_small_is_rejected(self): - visibility = Visibility(None, None, None, ha_limit_neg=1.0) + with pytest.raises(InvalidHourAngleLimit): + visibility = Visibility(None, None, None, ha_limit_neg=1.0) - @raises(InvalidHourAngleLimit) def test_positive_hour_angle_too_big_is_rejected(self): - visibility = Visibility(None, None, None, ha_limit_pos=13.0) + with pytest.raises(InvalidHourAngleLimit): + visibility = Visibility(None, None, None, ha_limit_pos=13.0) - @raises(InvalidHourAngleLimit) def test_positive_hour_angle_too_small_is_rejected(self): - visibility = Visibility(None, None, None, ha_limit_pos=-1.0) - + with pytest.raises(InvalidHourAngleLimit): + visibility = Visibility(None, None, None, ha_limit_pos=-1.0) def test_sites(self): site_filename="test/telescopes.dat" @@ -686,8 +678,8 @@ def test_target_up_intervals_jpl_major_planet(self): # Jupiter is above the horizon and within ha_limits from rise time 1:27 until 5:55 observable_intervals = coalesce_adjacent_intervals(observable_intervals) rise_time = datetime(2012, 2, 1, 1, 27, 51, 357328) - assert_equal(observable_intervals[0][0], rise_time) - assert_equal(observable_intervals[0][1], datetime(2012, 2, 1, 5, 45)) + assert observable_intervals[0][0] == rise_time + assert observable_intervals[0][1] == datetime(2012, 2, 1, 5, 45) def test_target_up_intervals_jpl_major_planet_high_ha(self): site = self.site.copy() @@ -702,8 +694,8 @@ def test_target_up_intervals_jpl_major_planet_high_ha(self): observable_intervals = coalesce_adjacent_intervals(observable_intervals) rise_time = datetime(2012, 2, 1, 1, 27, 51, 357328) - assert_equal(observable_intervals[0][0], rise_time) - assert_equal(observable_intervals[0][1], datetime(2012, 2, 1, 7, 45)) + assert observable_intervals[0][0] == rise_time + assert observable_intervals[0][1] == datetime(2012, 2, 1, 7, 45) def test_target_up_intervals_jpl_major_planet_high_ha_and_no_horizon(self): site = self.site.copy() @@ -717,8 +709,8 @@ def test_target_up_intervals_jpl_major_planet_high_ha_and_no_horizon(self): # with maxed horizon and ha_limits, the observable intervals basically become the dark intervals observable_intervals = coalesce_adjacent_intervals(observable_intervals) - assert_equal(observable_intervals[0][0], dark_intervals[0][0]) - assert_equal(observable_intervals[0][1], dark_intervals[0][1]) + assert observable_intervals[0][0] == dark_intervals[0][0] + assert observable_intervals[0][1] == dark_intervals[0][1] class TestAirmassCalculation(unittest.TestCase): @@ -755,14 +747,14 @@ def interval_for_airmass(self, airmass): def test_set_airmass_limit_no_airmass(self): horizon = 30 expected = horizon - assert_equal(set_airmass_limit(None, horizon), expected) + assert set_airmass_limit(None, horizon) == expected def test_set_airmass_limit_airmass_worse_than_horizon(self): horizon = 30 airmass = 3 expected = horizon - assert_equal(set_airmass_limit(airmass, horizon), expected) + assert set_airmass_limit(airmass, horizon) == expected def test_set_airmass_limit_airmass_better_than_horizon(self): @@ -778,7 +770,7 @@ def test_airmass_is_applied_if_above_horizon_and_not_otherwise(self): interval_with_airmass = self.interval_for_airmass(airmass_above_horizon) interval_without_airmass = self.interval_for_airmass(airmass_below_horizon) - assert_less(interval_with_airmass, interval_without_airmass) + assert interval_with_airmass < interval_without_airmass class TestMoonDistanceCalculation(object): @@ -841,7 +833,7 @@ def test_moon_distance_no_angle(self): target_intervals = v.get_target_intervals(target=self.sidereal_target) moon_distance_intervals = v.get_moon_distance_intervals(self.sidereal_target, target_intervals, moon_distance_constraint) - assert_equal(moon_distance_intervals, target_intervals) + assert moon_distance_intervals == target_intervals def test_moon_distance_none_removed(self): start = datetime(2012, 1, 2) @@ -853,7 +845,7 @@ def test_moon_distance_none_removed(self): target_intervals = v.get_target_intervals(target=self.sidereal_target) moon_distance_intervals = v.get_moon_distance_intervals(self.sidereal_target, target_intervals, moon_distance_constraint) - assert_equal(moon_distance_intervals, target_intervals) + assert moon_distance_intervals == target_intervals def test_moon_distance_half_removed(self): start = datetime(2012, 1, 2) @@ -867,7 +859,7 @@ def test_moon_distance_half_removed(self): moon_distance_intervals = v.get_moon_distance_intervals(self.sidereal_target, target_intervals, moon_distance_constraint) # test that just the evening interval is returned by the moon_distance_intervals - assert_equal(moon_distance_intervals, [target_intervals[1]]) + assert moon_distance_intervals == [target_intervals[1]] def test_moon_distance_all_removed(self): start = datetime(2012, 1, 2) @@ -880,7 +872,7 @@ def test_moon_distance_all_removed(self): moon_distance_intervals = v.get_moon_distance_intervals(self.sidereal_target, target_intervals, moon_distance_constraint) # test that no moon distance intervals are returned due to the constraint of > 75 degrees distance - assert_equal(moon_distance_intervals, []) + assert moon_distance_intervals == [] def test_moon_distance_ignored_for_satellite_target(self): start = datetime(2012, 1, 2) @@ -892,7 +884,7 @@ def test_moon_distance_ignored_for_satellite_target(self): observable_intervals = v.get_observable_intervals(target) # check that this doesn't crash, and that intervals match night intervals night_intervals = v.get_dark_intervals() - assert_equal(night_intervals, observable_intervals) + assert night_intervals == observable_intervals def test_moon_distance_ignored_for_hour_angle_target(self): start = datetime(2012, 1, 2) @@ -904,7 +896,7 @@ def test_moon_distance_ignored_for_hour_angle_target(self): observable_intervals = v.get_observable_intervals(target) # check that this doesn't crash, and that intervals match night intervals night_intervals = v.get_dark_intervals() - assert_equal(night_intervals, observable_intervals) + assert night_intervals == observable_intervals def test_moon_distance_minor_planet_half_removed(self): start = datetime(2012, 8, 2) @@ -920,9 +912,9 @@ def test_moon_distance_minor_planet_half_removed(self): moon_distance_intervals = v.get_moon_distance_intervals(target, target_intervals, moon_distance_constraint) # Verify that moon distance intervals only goes until 21:00 - assert_equal(moon_distance_intervals[0][0], target_intervals[0][0]) - assert_equal(moon_distance_intervals[0][1], datetime(2012, 8, 2, 21, 0)) - assert_equal(len(moon_distance_intervals), 1) + assert moon_distance_intervals[0][0] == target_intervals[0][0] + assert moon_distance_intervals[0][1] == datetime(2012, 8, 2, 21, 0) + assert len(moon_distance_intervals) == 1 def test_moon_distance_minor_planet_half_removed_2(self): start = datetime(2012, 1, 2) @@ -938,11 +930,11 @@ def test_moon_distance_minor_planet_half_removed_2(self): moon_distance_intervals = v.get_moon_distance_intervals(target, target_intervals, moon_distance_constraint) # Verify that moon distance intervals only appear from 6:00 to 6:45 and from 23:30 to 24:00 - assert_equal(len(moon_distance_intervals), 2) - assert_equal(moon_distance_intervals[0][0], datetime(2012, 1, 2, 6, 15)) - assert_equal(moon_distance_intervals[0][1], datetime(2012, 1, 2, 6, 45)) - assert_equal(moon_distance_intervals[1][0], datetime(2012, 1, 2, 23, 30)) - assert_equal(moon_distance_intervals[1][1], datetime(2012, 1, 3, 0, 0)) + assert len(moon_distance_intervals) == 2 + assert moon_distance_intervals[0][0] == datetime(2012, 1, 2, 6, 15) + assert moon_distance_intervals[0][1] == datetime(2012, 1, 2, 6, 45) + assert moon_distance_intervals[1][0] == datetime(2012, 1, 2, 23, 30) + assert moon_distance_intervals[1][1] == datetime(2012, 1, 3, 0, 0) def test_moon_distance_minor_planet_none_removed(self): start = datetime(2012, 2, 2) @@ -958,11 +950,11 @@ def test_moon_distance_minor_planet_none_removed(self): moon_distance_intervals = v.get_moon_distance_intervals(target, target_intervals, moon_distance_constraint) # Verify that moon distance intervals only appear during the full target interval - assert_equal(len(moon_distance_intervals), 2) - assert_equal(moon_distance_intervals[0][0], datetime(2012, 2, 2, 0, 0)) - assert_equal(moon_distance_intervals[0][1], datetime(2012, 2, 2, 5, 15)) - assert_equal(moon_distance_intervals[1][0], datetime(2012, 2, 2, 22, 00)) - assert_equal(moon_distance_intervals[1][1], datetime(2012, 2, 3, 0, 0)) + assert len(moon_distance_intervals) == 2 + assert moon_distance_intervals[0][0] == datetime(2012, 2, 2, 0, 0) + assert moon_distance_intervals[0][1] == datetime(2012, 2, 2, 5, 15) + assert moon_distance_intervals[1][0] == datetime(2012, 2, 2, 22, 00) + assert moon_distance_intervals[1][1] == datetime(2012, 2, 3, 0, 0) def test_moon_distance_minor_planet_all_removed(self): start = datetime(2012, 1, 2) @@ -978,7 +970,7 @@ def test_moon_distance_minor_planet_all_removed(self): moon_distance_intervals = v.get_moon_distance_intervals(target, target_intervals, moon_distance_constraint) # Verify that moon distance intervals only appear from 6:00 to 6:45 and from 23:30 to 24:00 - assert_equal(len(moon_distance_intervals), 0) + assert len(moon_distance_intervals) == 0 def test_moon_distance_comet_non_removed(self): start = datetime(2012, 7, 22) @@ -993,13 +985,10 @@ def test_moon_distance_comet_non_removed(self): target_intervals = v.get_target_intervals(target=target) moon_distance_intervals = v.get_moon_distance_intervals(target, target_intervals, moon_distance_constraint) - print(target_intervals) - print(moon_distance_intervals) - # Verify that moon distance intervals is the entire target interval - assert_equal(len(moon_distance_intervals), 1) - assert_equal(moon_distance_intervals[0][0], target_intervals[0][0]) - assert_equal(moon_distance_intervals[0][1], target_intervals[-1][1]) + assert len(moon_distance_intervals) == 1 + assert moon_distance_intervals[0][0] == target_intervals[0][0] + assert moon_distance_intervals[0][1] == target_intervals[-1][1] def test_moon_distance_comet_all_removed(self): start = datetime(2012, 7, 22) @@ -1015,7 +1004,7 @@ def test_moon_distance_comet_all_removed(self): moon_distance_intervals = v.get_moon_distance_intervals(target, target_intervals, moon_distance_constraint) # Verify that there are no moon distance intervals - assert_equal(len(moon_distance_intervals), 0) + assert len(moon_distance_intervals) == 0 def test_moon_distance_major_planet_none_removed(self): start = datetime(2012, 2, 1) @@ -1029,9 +1018,9 @@ def test_moon_distance_major_planet_none_removed(self): target_intervals = coalesce_adjacent_intervals(target_intervals) # Verify that moon distance intervals is the entire target interval - assert_equal(len(moon_distance_intervals), len(target_intervals)) - assert_equal(moon_distance_intervals[0][0], target_intervals[0][0]) - assert_equal(moon_distance_intervals[0][1], target_intervals[0][1]) + assert len(moon_distance_intervals) == len(target_intervals) + assert moon_distance_intervals[0][0] == target_intervals[0][0] + assert moon_distance_intervals[0][1] == target_intervals[0][1] def test_moon_distance_major_planet_all_removed(self): start = datetime(2012, 2, 1) @@ -1044,7 +1033,7 @@ def test_moon_distance_major_planet_all_removed(self): moon_distance_intervals = v.get_moon_distance_intervals(target, target_intervals, Angle(degrees=31)) # Verify that there are no moon distance intervals - assert_equal(len(moon_distance_intervals), 0) + assert len(moon_distance_intervals) == 0 def test_moon_distance_major_planet_some_removed(self): start = datetime(2012, 2, 1) @@ -1058,11 +1047,11 @@ def test_moon_distance_major_planet_some_removed(self): target_intervals = coalesce_adjacent_intervals(target_intervals) # Verify that the first moon distance interval truncated to start at 3:45 but otherwise matches the target int - assert_equal(len(moon_distance_intervals), 2) - assert_equal(moon_distance_intervals[0][0], datetime(2012, 2, 1, 3, 45)) - assert_equal(moon_distance_intervals[0][1], target_intervals[0][1]) - assert_equal(moon_distance_intervals[1][0], target_intervals[1][0]) - assert_equal(moon_distance_intervals[1][1], target_intervals[1][1]) + assert len(moon_distance_intervals) == 2 + assert moon_distance_intervals[0][0] == datetime(2012, 2, 1, 3, 45) + assert moon_distance_intervals[0][1] == target_intervals[0][1] + assert moon_distance_intervals[1][0] == target_intervals[1][0] + assert moon_distance_intervals[1][1] == target_intervals[1][1] class TestMoonPhaseCalculation(object): @@ -1093,14 +1082,14 @@ def test_moon_phase_none_removed(self): target_intervals = v.get_target_intervals(target=self.sidereal_target) moon_phase_intervals = v.get_moon_phase_intervals(target_intervals, max_moon_phase) - assert_equal(moon_phase_intervals, target_intervals) + assert moon_phase_intervals == target_intervals # Test the observable intervals as well, must combine moon phase with dark and ha intervals observable_intervals = v.get_observable_intervals(target=self.sidereal_target, moon_distance=Angle(degrees=0), moon_phase=max_moon_phase) ha_intervals = v.get_ha_intervals(self.sidereal_target) dark_intervals = v.get_dark_intervals() combined_moon_phase_intervals = intersect_many_intervals(moon_phase_intervals, ha_intervals, dark_intervals) - assert_equal(combined_moon_phase_intervals, observable_intervals) + assert combined_moon_phase_intervals == observable_intervals def test_moon_phase_all_removed_except_when_moon_down(self): start = datetime(2012, 1, 2) @@ -1114,14 +1103,14 @@ def test_moon_phase_all_removed_except_when_moon_down(self): moon_down_intervals = v.get_moon_dark_intervals() moon_down_intervals = intersect_intervals(target_intervals, moon_down_intervals) - assert_equal(moon_phase_intervals, moon_down_intervals) + assert moon_phase_intervals == moon_down_intervals # Test the observable intervals as well, must combine moon phase with dark and ha intervals observable_intervals = v.get_observable_intervals(target=self.sidereal_target, moon_distance=Angle(degrees=0), moon_phase=max_moon_phase) ha_intervals = v.get_ha_intervals(self.sidereal_target) dark_intervals = v.get_dark_intervals() combined_moon_phase_intervals = intersect_many_intervals(moon_phase_intervals, ha_intervals, dark_intervals) - assert_equal(combined_moon_phase_intervals, observable_intervals) + assert combined_moon_phase_intervals == observable_intervals def test_moon_phase_some_removed(self): start = datetime(2012, 1, 2) @@ -1135,14 +1124,14 @@ def test_moon_phase_some_removed(self): moon_down_intervals = v.get_moon_dark_intervals() # The first target interval is below the moon phase constraint, but the second is above it so its only good while the moon is down expected_intervals = [target_intervals[0], (target_intervals[1][0], moon_down_intervals[0][1])] - assert_equal(moon_phase_intervals, expected_intervals) + assert moon_phase_intervals == expected_intervals # Test the observable intervals as well, must combine moon phase with dark and ha intervals observable_intervals = v.get_observable_intervals(target=self.sidereal_target, moon_distance=Angle(degrees=0), moon_phase=max_moon_phase) ha_intervals = v.get_ha_intervals(self.sidereal_target) dark_intervals = v.get_dark_intervals() combined_moon_phase_intervals = intersect_many_intervals(moon_phase_intervals, ha_intervals, dark_intervals) - assert_equal(combined_moon_phase_intervals, observable_intervals) + assert combined_moon_phase_intervals == observable_intervals def test_moon_phase_longer(self): start = datetime(2012, 1, 1) @@ -1174,7 +1163,7 @@ def test_moon_phase_longer(self): if interval[0] > datetime(2012, 1, 28, 23): expected_intervals.append(interval) - assert_equal(moon_phase_intervals, expected_intervals) + assert moon_phase_intervals == expected_intervals class TestZenithDistanceCalculation(unittest.TestCase): @@ -1260,7 +1249,7 @@ def test_moon_distance_ignored_for_satellite_target(self): observable_intervals = self.v.get_observable_intervals(target) # check that this doesn't crash, and that intervals match night intervals night_intervals = self.v.get_dark_intervals() - assert_equal(night_intervals, observable_intervals) + assert night_intervals == observable_intervals def test_moon_distance_ignored_for_hour_angle_target(self): start = datetime(2012, 1, 2) @@ -1271,7 +1260,7 @@ def test_moon_distance_ignored_for_hour_angle_target(self): observable_intervals = self.v.get_observable_intervals(target) # check that this doesn't crash, and that intervals match night intervals night_intervals = self.v.get_dark_intervals() - assert_equal(night_intervals, observable_intervals) + assert night_intervals == observable_intervals class TestZDIntervalsZeroZenithDistance(TestZenithDistanceCalculation): @@ -1291,7 +1280,7 @@ def test_zd_intervals_zero_zd_sidereal_target(self): zenith_distance_intervals = self.v.get_zenith_distance_intervals(target, target_intervals) coalesced_target_intervals = coalesce_adjacent_intervals(target_intervals) - assert_equal(zenith_distance_intervals, coalesced_target_intervals) + assert zenith_distance_intervals == coalesced_target_intervals def test_zd_intervals_zero_zd_non_sidereal_major_planet_target(self): target = self.major_planet_target @@ -1300,7 +1289,7 @@ def test_zd_intervals_zero_zd_non_sidereal_major_planet_target(self): zenith_distance_intervals = self.v.get_zenith_distance_intervals(target, target_intervals) coalesced_target_intervals = coalesce_adjacent_intervals(target_intervals) - assert_equal(zenith_distance_intervals, coalesced_target_intervals) + assert zenith_distance_intervals == coalesced_target_intervals def test_zd_intervals_zero_zd_non_sidereal_minor_planet_target(self): target = self.minor_planet_target @@ -1309,7 +1298,7 @@ def test_zd_intervals_zero_zd_non_sidereal_minor_planet_target(self): zenith_distance_intervals = self.v.get_zenith_distance_intervals(target, target_intervals) coalesced_target_intervals = coalesce_adjacent_intervals(target_intervals) - assert_equal(zenith_distance_intervals, coalesced_target_intervals) + assert zenith_distance_intervals == coalesced_target_intervals def test_zd_intervals_zero_zd_non_sidereal_comet_target(self): target = self.comet_target @@ -1318,7 +1307,7 @@ def test_zd_intervals_zero_zd_non_sidereal_comet_target(self): zenith_distance_intervals = self.v.get_zenith_distance_intervals(target, target_intervals) coalesced_target_intervals = coalesce_adjacent_intervals(target_intervals) - assert_equal(zenith_distance_intervals, coalesced_target_intervals) + assert zenith_distance_intervals == coalesced_target_intervals class TestZDIntervals180ZenithDistance(TestZenithDistanceCalculation): @@ -1336,7 +1325,7 @@ def test_zd_intervals_180_zd_sidereal_target(self): target_intervals = self.v.get_target_intervals(target=target) zenith_distance_intervals = self.v.get_zenith_distance_intervals(target, target_intervals) - assert_equal(len(zenith_distance_intervals), 0) + assert len(zenith_distance_intervals) == 0 def test_zd_intervals_180_zd_non_sidereal_major_planet_target(self): target = self.major_planet_target @@ -1344,7 +1333,7 @@ def test_zd_intervals_180_zd_non_sidereal_major_planet_target(self): target_intervals = self.v.get_target_intervals(target=target) zenith_distance_intervals = self.v.get_zenith_distance_intervals(target, target_intervals) - assert_equal(len(zenith_distance_intervals), 0) + assert len(zenith_distance_intervals) == 0 def test_zd_intervals_180_zd_non_sidereal_minor_planet_target(self): target = self.minor_planet_target @@ -1352,7 +1341,7 @@ def test_zd_intervals_180_zd_non_sidereal_minor_planet_target(self): target_intervals = self.v.get_target_intervals(target=target) zenith_distance_intervals = self.v.get_zenith_distance_intervals(target, target_intervals) - assert_equal(len(zenith_distance_intervals), 0) + assert len(zenith_distance_intervals) == 0 def test_zd_intervals_180_zd_non_sidereal_comet_target(self): target = self.comet_target @@ -1360,7 +1349,7 @@ def test_zd_intervals_180_zd_non_sidereal_comet_target(self): target_intervals = self.v.get_target_intervals(target=target) zenith_distance_intervals = self.v.get_zenith_distance_intervals(target, target_intervals) - assert_equal(len(zenith_distance_intervals), 0) + assert len(zenith_distance_intervals) == 0 class TestMajorPlanetZenithDistanceIntervals(TestZenithDistanceCalculation): @@ -1404,7 +1393,7 @@ def test_jupiter(self): (datetime(2012, 2, 1, 3, 32), datetime(2012, 2, 1, 8, 30)), (datetime(2012, 2, 1, 22, 15), self.v.end_date) ] - assert_equal(expected_intervals, zenith_intervals) + assert expected_intervals == zenith_intervals class TestCometZenithDistanceIntervals(TestZenithDistanceCalculation): @@ -1451,7 +1440,7 @@ def test_sidereal_target(self): (datetime(2012, 7, 22, 4, 27), datetime(2012, 7, 22, 7, 45)), (datetime(2012, 7, 22, 23, 45), self.v.end_date) ] - assert_equal(expected_intervals, zenith_intervals) + assert expected_intervals == zenith_intervals class TestZDvsAltitude(TestZenithDistanceCalculation): diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 5ec9f1a..0000000 --- a/tox.ini +++ /dev/null @@ -1,17 +0,0 @@ -[tox] -envlist = py27, p34 -#setting an explicit server to get numpy from FIRST -#numpy is required for the setup.py of pySLALIB, so it is important to install it first -#you cannot just do the normal pip install x y numpy z pySLALIB as this will fail -indexserver= - s1 = https://pypi.org/simple -[testenv] -setenv = - PYTHONHASHSEED = 0 -#normally we would just include the requirements and test_requirements files, but for pySLALIB we must -#include numpy first to be able to build pySLALIB. -deps = py27: :s1:numpy<1.17 - p34: :s1:numpy - -rrequirements.pip - -rtest_requirements.pip -commands=nosetests --with-xunit