From e418bbf3801e77cb80a0858728e724c303e3541b Mon Sep 17 00:00:00 2001 From: dqy <1016751306@qq.com> Date: Wed, 29 May 2024 20:32:24 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B7=BB=E5=8A=A0=E5=8F=8D=E6=B1=87?= =?UTF-8?q?=E7=BC=96=E4=B9=8B=E5=90=8E=E7=9A=84=E6=AD=A3=E5=88=99=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_backdoor_detection.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_backdoor_detection.py b/tests/test_backdoor_detection.py index ebbcd58..d366df1 100644 --- a/tests/test_backdoor_detection.py +++ b/tests/test_backdoor_detection.py @@ -90,6 +90,23 @@ class TestBackdoorDetection(unittest.TestCase): with self.assertRaises(ValueError): detectGPT(content) + def test_find_dangerous_functions_pyc(self): + file_content = """import os + os.system('rm -rf /') + """ + file_extension = ".pyc" + + expected_result = { + "high": [(2, "os.system('rm -rf /')")], + "medium": [], + "low": [], + "none": [], + } + + result = find_dangerous_functions(file_content, file_extension) + + self.assertEqual(result, expected_result) + if __name__ == "__main__": unittest.main()