본문 바로가기

F-string9

Pytest _ client 에서 parmas 값 넣는 방법 테스트 코드를 작성하다보면 client를 사용해 uri요청을 보낼 때가 있습니다. 그리고 쿼리 파라미터(query string)는 패스 파라미터와 마찬가지로 uri를 텍스트로 작성해 보낼 수 있습니다. uri를 만드는 방법 세 가지를 함께 보겠습니다. 방법1. 일반 텍스트 response = client.get( "http://0.0.0.0:8000/users?limit=10&offset=0" ) 하지만 텍스트로만 작성할 경우, 하나의 케이스만 테스트 할 수 있는 정적 값이 되고 맙니다. 방법2. f-string 다음처럼 f-string을 통해 동적 값을 넣어줄 수 있습니다. limit = 10 offset = 0 response = client.get( f"http://0.0.0.0:8000/users.. 2022. 4. 27.
Meeting Description: John has invited some friends. His list is: s = "Fred:Corwill;Wilfred:Corwill;Barney:Tornbull;Betty:Tornbull;Bjon:Tornbull;Raphael:Corwill;Alfred:Corwill"; Could you make a program that makes this string uppercase gives it sorted in alphabetical order by last name. When the last names are the same, sort them by first name. Last name and first name of a guest come in the result betwe.. 2022. 3. 17.
Create Phone Number 문제 설명 Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number. Example create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) # => returns "(123) 456-7890" The returned format must be correct in order to complete this challenge. Don't forget the space after the closing parentheses! 해결 방법 1. n에 담긴 숫자 요소들을 문자로 바꾼다. .. 2022. 2. 14.