格式:统一使用业务代码 Ruff 格式

This commit is contained in:
焦龙言
2026-07-27 15:59:09 +08:00
parent 37c94b6713
commit 684dd451bb
2 changed files with 3 additions and 9 deletions
@@ -130,9 +130,7 @@ class UsageService:
@staticmethod @staticmethod
def _success(usage: BizUsageRecord) -> CrudResponseModel: def _success(usage: BizUsageRecord) -> CrudResponseModel:
remaining_packages = usage.remaining_packages_after remaining_packages = usage.remaining_packages_after
flow_state = ( flow_state = PalletFlowState.AT_SITE_EMPTY if remaining_packages == 0 else PalletFlowState.AT_SITE_PARTIAL
PalletFlowState.AT_SITE_EMPTY if remaining_packages == 0 else PalletFlowState.AT_SITE_PARTIAL
)
return CrudResponseModel( return CrudResponseModel(
is_success=True, is_success=True,
message='使用成功', message='使用成功',
@@ -581,9 +581,7 @@ class TestUsageControllerContract(unittest.TestCase):
response_schema = schema['components']['schemas'][post_response_schema['$ref'].rsplit('/', 1)[-1]] response_schema = schema['components']['schemas'][post_response_schema['$ref'].rsplit('/', 1)[-1]]
self.assertIn('data', response_schema['properties']) self.assertIn('data', response_schema['properties'])
self.assertIn('data', response_schema['required']) self.assertIn('data', response_schema['required'])
data_schema = schema['components']['schemas'][ data_schema = schema['components']['schemas'][response_schema['properties']['data']['$ref'].rsplit('/', 1)[-1]]
response_schema['properties']['data']['$ref'].rsplit('/', 1)[-1]
]
self.assertEqual( self.assertEqual(
{'usageId', 'remainingPackages', 'flowState'}, {'usageId', 'remainingPackages', 'flowState'},
set(data_schema['properties']), set(data_schema['properties']),
@@ -1472,9 +1470,7 @@ class TestUsageIdempotency(unittest.IsolatedAsyncioTestCase):
), ),
) )
expected_state = ( expected_state = (
PalletFlowState.AT_SITE_EMPTY PalletFlowState.AT_SITE_EMPTY if remaining_after == 0 else PalletFlowState.AT_SITE_PARTIAL
if remaining_after == 0
else PalletFlowState.AT_SITE_PARTIAL
) )
self.assertIsInstance(result.result, UsageSuccessResponseModel) self.assertIsInstance(result.result, UsageSuccessResponseModel)
self.assertEqual( self.assertEqual(