refactor: move tests out of package directory (#97)

This commit is contained in:
Bipin Thapa authored and GitHub committed 2026-03-23 18:33:14 +05:45
1 parent 0a255fa270
commit 3d6c448f69
15 files changed
+23 -30

No files matched your search

+1 -1
View File
@@ -39,7 +39,7 @@ jobs:
- name: Run tests
run: |
coverage run -m unittest discover nepali/tests -v
coverage run -m unittest discover tests -v
- name: Show coverage
run: |
+1
View File
@@ -13,6 +13,7 @@ repos:
rev: v2.1.1
hooks:
- id: darker
files: ^(nepali/|tests/)
args:
- --isort
- --flynt
+3 -3
View File
@@ -4,14 +4,14 @@
# @file
# @version 0.2
test:
python -m unittest discover nepali/tests -v
python -m unittest discover tests -v
coverage:
coverage run -m unittest discover nepali/tests -v
coverage run -m unittest discover tests -v
coverage report
coverage-html:
rm -rf htmlcov
coverage run -m unittest discover nepali/tests -v
coverage run -m unittest discover tests -v
coverage html
open htmlcov/index.html
+1 -1
View File
@@ -56,7 +56,7 @@ setuptools.setup(
],
url=GITHUB_URL,
packages=setuptools.find_packages(exclude=["tests*"]),
test_suite="nepali.tests",
test_suite="tests",
python_requires=">=3.10",
install_requires=[],
classifiers=[
File renamed without changes.
@@ -3,6 +3,7 @@ To run only this unit test use the command below.
python -m unittest nepali/tests/test_date_converter.py -v
"""
import unittest
from nepali.date_converter import converter
@@ -10,6 +11,7 @@ from nepali.date_converter import converter
class TestNepaliDateConverter(unittest.TestCase):
"""tests for date_converter.converter module"""
# test date range
def test_english_date_range(self):
self.assertEqual(converter.en_min_year(), 1944)
@@ -192,9 +192,7 @@ class TestNepaliDateTime(unittest.TestCase):
self.assertEqual(
python_datetime_obj,
nepalidatetime_obj.to_datetime(),
msg="{} and {} are not equal.".format(
python_datetime_obj, nepalidatetime_obj.to_datetime()
),
msg=f"{python_datetime_obj} and {nepalidatetime_obj.to_datetime()} are not equal.",
)
def test_nepalidatetime_strftime(self):
File renamed without changes.
File renamed without changes.
@@ -3,6 +3,7 @@ To run only this unit test use the command below.
python -m unittest nepali/tests/test_nepalimonth.py -v
"""
import unittest
from nepali.datetime import nepalimonth
@@ -3,6 +3,7 @@ To run only this unit test use the command below.
python -m unittest nepali/tests/test_nepaliweek.py -v
"""
import unittest
from nepali.datetime import nepaliweek
@@ -3,6 +3,7 @@ To run only this unit test use the command below.
python -m unittest nepali/tests/test_number.py -v
"""
import unittest
from nepali import number
@@ -2571,9 +2572,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
self.assertEqual(self.nepalinumber_integer_2**2, self.nepalinumber_integer_4)
def test_positive_nepalinumber_integer_can_be_powered_to_positive_float(self):
self.assertEqual(
self.nepalinumber_integer_2**2.5, number.nepalinumber(2**2.5)
)
self.assertEqual(self.nepalinumber_integer_2**2.5, number.nepalinumber(2**2.5))
def test_positive_nepalinumber_integer_can_be_powered_to_negative_integer(self):
self.assertEqual(self.nepalinumber_integer_2**-1, self.nepalinumber_float_0_5)
@@ -2620,9 +2619,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
self.assertEqual(2**self.nepalinumber_integer_2, self.nepalinumber_integer_4)
def test_positive_float_can_be_powered_to_positive_nepalinumber_integer(self):
self.assertEqual(
2.5**self.nepalinumber_integer_2, number.nepalinumber(2.5**2)
)
self.assertEqual(2.5**self.nepalinumber_integer_2, number.nepalinumber(2.5**2))
def test_negative_integer_can_be_powered_to_positive_nepalinumber_integer(self):
self.assertEqual(
@@ -2668,9 +2665,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
)
def test_positive_nepalinumber_float_can_be_powered_to_negative_integer(self):
self.assertEqual(
self.nepalinumber_float_1_5**-2, number.nepalinumber(1.5**-2)
)
self.assertEqual(self.nepalinumber_float_1_5**-2, number.nepalinumber(1.5**-2))
def test_positive_nepalinumber_float_can_be_powered_to_negative_float(self):
self.assertEqual(
@@ -2703,9 +2698,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
# pow positive nepalinumber float as exponent
def test_positive_integer_can_be_powered_to_positive_nepalinumber_float(self):
self.assertEqual(
2**self.nepalinumber_float_1_5, number.nepalinumber(2**1.5)
)
self.assertEqual(2**self.nepalinumber_float_1_5, number.nepalinumber(2**1.5))
def test_positive_float_can_be_powered_to_positive_nepalinumber_float(self):
self.assertEqual(
@@ -2762,8 +2755,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
self,
):
self.assertEqual(
self.nepalinumber_negative_integer_2
** self.nepalinumber_negative_integer_1,
self.nepalinumber_negative_integer_2**self.nepalinumber_negative_integer_1,
self.nepalinumber_negative_float_0_5,
)
@@ -2771,8 +2763,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
self,
):
self.assertEqual(
self.nepalinumber_negative_integer_2
** self.nepalinumber_negative_float_1_5,
self.nepalinumber_negative_integer_2**self.nepalinumber_negative_float_1_5,
(-2) ** -1.5,
)
@@ -2802,8 +2793,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
self,
):
self.assertEqual(
self.nepalinumber_negative_float_1_5
** self.nepalinumber_negative_integer_2,
self.nepalinumber_negative_float_1_5**self.nepalinumber_negative_integer_2,
number.nepalinumber((-1.5) ** (-2)),
)
@@ -2835,8 +2825,7 @@ class TestNepaliNumberArithmeticOperations(unittest.TestCase):
self,
):
self.assertEqual(
self.nepalinumber_negative_float_1_5
** self.nepalinumber_negative_float_1_5,
self.nepalinumber_negative_float_1_5**self.nepalinumber_negative_float_1_5,
(-1.5) ** -1.5,
)
File renamed without changes.
@@ -2,11 +2,11 @@ import unittest
from unittest import mock
from nepali.phone_number import (
Operator,
Area,
Operator,
_get_area,
_get_area_code,
_get_operator,
_get_area,
_parse_landline_number,
_parse_mobile_number,
get_exact_number,
@@ -3,6 +3,7 @@ To run only this unit test use the command below.
python -m unittest nepali/tests/test_timezone.py -v
"""
import datetime
import unittest
from unittest.mock import patch