File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -62,3 +62,23 @@ def test_priority_comparison():
6262 order2 = Order (data2 )
6363 # Priority 클래스 리팩토링 후 아래 테스트 활성화
6464 assert order1 .priority .higher_than (order2 .priority )
65+
66+
67+ def test_order_priority_setter ():
68+ # 문자열로 priority 설정 테스트
69+ order = Order ({"priority" : "normal" , "product" : "Widget" })
70+ order .priority = "high"
71+ assert order .priority == Priority ("high" )
72+
73+ # Priority 객체로 priority 설정 테스트
74+ new_priority = Priority ("rush" )
75+ order .priority = new_priority
76+ assert order .priority == Priority ("rush" )
77+ assert order .priority == new_priority # 참조 동일성이 아닌 값 동일성 확인
78+
79+ # 잘못된 값에 대한 예외 발생 테스트
80+ try :
81+ order .priority = "invalid"
82+ assert False , "잘못된 우선순위 값이 허용되었습니다"
83+ except ValueError :
84+ pass # 예상대로 예외 발생
You can’t perform that action at this time.
0 commit comments