Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating Zixi Gan's Motto #8

Merged
merged 4 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,10 @@ jobs:
run: |
source $CONDA/bin/activate
cd tests
pytest test_QiangqiangGu.py -v -n auto
pytest test_QiangqiangGu.py -v -n auto

- name: Test ZixiGan's codes.
run: |
source $CONDA/bin/activate
cd tests
pytest test_ZixiGan.py -v -n auto
2 changes: 2 additions & 0 deletions doc/tutorial1_unittest.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ https://dptechnology.feishu.cn/wiki/wikcn3Qu95x0ItmltztkIvgDEec#
4. Yibo Wang
5. Yuhang Wang
6. Qiangqiang Gu
7. Zixi Gan

24 changes: 23 additions & 1 deletion dplc/motto/motto.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,26 @@ def verifyMottoQiangqiangGu(public_string: str) -> bool:
is_verified = False
if md5_string == "48f3cb54333cbceda32156f4f2a7dd33":
is_verified = True
return is_verified
return is_verified


def verifyMottoZixiGan(public_string: str) -> bool:
'''

Verify if a public string is Zixi Gan's motto.

Parameters:
---------
public_string: string, a public string from user input.

Returns:
-------
True: if the string matches with Zixi Gan's motto.
False: otherwise.
'''

in_md5 = md5_encoding(public_string)
if in_md5 == "083ecbdb5e5f1fc25aefb501f9b6c6e1":
return True
else:
return False
23 changes: 23 additions & 0 deletions tests/test_ZixiGan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import unittest
from dplc.motto.motto import verifyMottoZixiGan

class TestVerifyMottoZixiGan(unittest.TestCase):

@classmethod
def setUpClass(self):
pass

def test_verifyMottoZixigan_right(self):
right_motto = "Deep Dark Fantasy"
self.assertEqual(verifyMottoZixiGan(right_motto), True)

def test_verifyMottoZixigan_wrong(self):
wrong_motto = "As We Can"
self.assertEqual(verifyMottoZixiGan(wrong_motto), False)

@classmethod
def tearDownClass(self):
pass

if __name__ == "__main__":
unittest.main()
Loading