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

JijieZou add personal VerifyMotto #3

Merged
merged 6 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
5 changes: 5 additions & 0 deletions .github/workflows/ut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ jobs:
cd tests
pytest test_YuhangWang.py -v -n auto

- name: Test JijieZou's codes.
run: |
source $CONDA/bin/activate
cd tests
pytest test_JijieZou.py -v -n auto
- name: Test QiangqiangGu's codes.
run: |
source $CONDA/bin/activate
Expand Down
1 change: 1 addition & 0 deletions doc/tutorial1_unittest.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ https://dptechnology.feishu.cn/wiki/wikcn3Qu95x0ItmltztkIvgDEec#
5. Yuhang Wang
6. Qiangqiang Gu
7. Zixi Gan
8. Jijie Zou

26 changes: 25 additions & 1 deletion dplc/motto/motto.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def verifyMotto(P: argparse.Namespace):
is_verified = verifyMottoYiboWang(motto)
elif name == "YuhangWang":
is_verified = verifyMottoYuhangWang(motto)
elif name == "JijieZou":
is_verified = verifyMottoJijieZou(motto)
elif name == "QiangqiangGu":
is_verified = verifyMottoQiangqiangGu(motto)
else:
Expand Down Expand Up @@ -170,6 +172,7 @@ def verifyMottoQiangqiangGu(public_string: str) -> bool:
'''
md5_string = md5_encoding(public_string)
is_verified = False

if md5_string == "48f3cb54333cbceda32156f4f2a7dd33":
is_verified = True
return is_verified
Expand All @@ -194,4 +197,25 @@ def verifyMottoZixiGan(public_string: str) -> bool:
if in_md5 == "083ecbdb5e5f1fc25aefb501f9b6c6e1":
return True
else:
return False
return False

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

Verify if a public string is JijieZou's motto.

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

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

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


class TestVerifyMottoJijieZou(unittest.TestCase):

@classmethod
def setUpClass(self):
pass

def test_verifyMottoJijieZou_right(self):
right_motto = "You know who"
self.assertEqual(verifyMottoJijieZou(right_motto), True)

def test_verifyMottoJijieZou_wrong(self):
wrong_motto = "你猜"
self.assertEqual(verifyMottoJijieZou(wrong_motto), False)

@classmethod
def tearDownClass(cls):
pass


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