Skip to content

Commit

Permalink
feat: unit tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Feb 6, 2024
1 parent cc2885c commit da5a71a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Empty file added tests/__init__.py
Empty file.
26 changes: 26 additions & 0 deletions tests/test_date_converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import sys
import unittest
from os.path import dirname, join, abspath

sys.path.insert(0, abspath(join(dirname(__file__), '..')))

from nepali_date_utils.date_converter import converter

class TestDateConverter(unittest.TestCase):

# Test data sets
test_data = [
{"bs_date": "2054/04/1", "ad_date": "1997/07/16"},
{"bs_date": "2055/09/15", "ad_date": "1998/12/30"},
{"bs_date": "2077/04/20", "ad_date": "2020/08/04"},
]

def test_bs_to_ad(self):
for data in self.test_data:
bs_date = data["bs_date"]
expected_ad_date = data["ad_date"]
actual_ad_date = converter.bs_to_ad(bs_date)
self.assertEqual(actual_ad_date, expected_ad_date)

if __name__ == '__main__':
unittest.main()

0 comments on commit da5a71a

Please sign in to comment.