From 2b9fb53b8d192872df3a32c7c5314613de408cbc Mon Sep 17 00:00:00 2001 From: jianqi Date: Mon, 21 Sep 2026 20:27:33 +0800 Subject: [PATCH] first test --- README.md | 0 api/cls_mgmt_api.py | 4 +- api/test.py | 94 +++++++++++++++++++++++++++++++++++++++++++ dao/statistics_dao.py | 4 +- 4 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100644 api/test.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/api/cls_mgmt_api.py b/api/cls_mgmt_api.py index 99fe559..492a7c9 100644 --- a/api/cls_mgmt_api.py +++ b/api/cls_mgmt_api.py @@ -1,7 +1,7 @@ -from pathlib import Path -from fastapi import APIRouter, Depends, HTTPException, Query + +from fastapi import APIRouter, Depends, HTTPException, Query, Path from sqlalchemy.orm import Session from typing import List diff --git a/api/test.py b/api/test.py new file mode 100644 index 0000000..cc1122b --- /dev/null +++ b/api/test.py @@ -0,0 +1,94 @@ +# # +# # l1 = [1, 2, 3] +# # l2 = [4, 5, 6] +# # +# # dict11 = dict(zip(l1, l2)) +# # print(dict) +# # +# # d1 = {l1[k]: l2[k] for k in range(len(l1))} +# # print(d1) +# # print("="*30) +# # +# # dict_1 = {2:'c', 1:'a', 3:'b'} +# # print(f'原始: {dict_1}') +# # +# # dict_2 = dict(sorted(dict_1.items())) +# # print(f'升序:: {dict_2}') +# # +# # dict_3 = dict(sorted(dict_1.items(), reverse = True)) +# # print(f'降序:: {dict_3}') +# # +# # dict_4 = dict(sorted(dict_1.items(), reverse = True, key = lambda v: v[1])) +# # print(f'value 降序: {dict_4}') +# # +# # dict_5= dict(sorted(dict_1.items(), key = lambda v: v[1])) +# # print(f'value 升序 {dict_5}') +# # +# # d2 = {i:i for i in range(11)} +# # print(d2) +# # print('&&'*20) +# # +# # def func_1(func): +# # def hha(): +# # print("支付成功!!!") +# # func() +# # return hha +# # +# # @func_1 +# # def pay(): +# # print('支付成功') +# # @func_1 +# # def xia(): +# # print('xia') +# # +# # pay() +# # +# # print("&"*20) +# # xia() +# import random +# # teacher_list = [i for i in range(1, 11)] +# # class_list = [[], [], []] +# # +# # for teacher in teacher_list: +# # index = random.randint(0,2) +# # class_list[index].append(teacher) +# # +# # print(class_list) +# +# num_set = set() +# while True: +# num_set.add(random.randint(1, 100)) +# +# if len(num_set) == 10: +# break +# +# print(f'原始: {num_set}') +# num_set_1 = sorted(num_set, reverse=True) +# print(num_set_1) + +class IterSelf: + def __init__(self, max_num): + self.max_num = max_num + self.a, self.b = 1, 1 + self.cnt = 0 + + def __iter__(self): + return self + + def __next__(self): + self.cnt += 1 + ans = self.a + + if ans > self.max_num: + raise StopIteration + + self.a , self.b = self.b, self.a + self.b + return ans + +temp = IterSelf(13) +# for i in temp: +# print(f'index is {temp.cnt} and value is {i}') +print(next(temp)) +print(next(temp)) +print(next(temp)) +print(type(temp)) \ No newline at end of file diff --git a/dao/statistics_dao.py b/dao/statistics_dao.py index 74e6009..1b7be95 100644 --- a/dao/statistics_dao.py +++ b/dao/statistics_dao.py @@ -195,6 +195,8 @@ class StatisticsDao: .limit(top_n) ) + + ans = [ TopSalaryStudentItem( stu_name=row.name, @@ -290,7 +292,7 @@ class StatisticsDao: filter_query = base_query.filter(StuInfo.age > age) elif operator == "lt" or operator == "<": filter_query = base_query.filter(StuInfo.age < age) - elif operator == "eq" or operator == "=": + elif operator == "eq" or operator == "==": filter_query = base_query.filter(StuInfo.age == age) finally_data = filter_query.all()