Skip to content

Commit a49bb26

Browse files
niranjankagriclaude
andcommitted
Interview guide: ruff-formatted code examples (CI lint checks Markdown code blocks)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f776e4b commit a49bb26

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

‎docs/interview-questions.md‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ Compare tuples, sets or models in a single assert, so that a failure shows all t
202202

203203
```python
204204
assert (note.title, note.description, note.category) == (data.title, data.description, category)
205-
assert {note.id for note in notes} == created # order does not matter
206-
assert ApiResponse[Note].model_validate(response.json()).data == note # pydantic models compare by value
205+
assert {note.id for note in notes} == created # order does not matter
206+
assert ApiResponse[Note].model_validate(response.json()).data == note # pydantic models compare by value
207207
```
208208

209209
**In the framework:**
@@ -283,7 +283,7 @@ then decides how many items it needs, and the fixture cleans up all of them:
283283
@pytest.fixture
284284
def unregistered_cleanup(settings):
285285
created = []
286-
yield created # the test appends (email, password)
286+
yield created # the test appends (email, password)
287287
for email, password in created:
288288
_delete_account(settings, email, password)
289289
```
@@ -461,7 +461,7 @@ may still be updating. Use `expect` for anything shown in the page.
461461

462462
```python
463463
expect(notes_page.progress).to_have_text("You have completed all notes")
464-
expect(notes_page.card_titles).to_have_text([notes["Work"].title]) # the exact list of elements
464+
expect(notes_page.card_titles).to_have_text([notes["Work"].title]) # the exact list of elements
465465
```
466466

467467
**In the framework:** UI tests assert with `expect`; plain `assert` is used only for API values.
@@ -619,7 +619,7 @@ A contract test checks that the response has the agreed shape: every field prese
619619
types and allowed values, and no surprise fields. In pydantic you describe the shape once as a model:
620620

621621
```python
622-
class Note(Contract): # Contract sets extra="forbid"
622+
class Note(Contract): # Contract sets extra="forbid"
623623
id: str
624624
category: Literal["Home", "Work", "Personal"]
625625
completed: bool
@@ -649,9 +649,10 @@ class ApiResponse(Contract, Generic[T]):
649649
message: str
650650
data: T | None = None
651651

652-
ApiResponse[Note] # one note
653-
ApiResponse[list[Note]] # a list
654-
ApiResponse[User] # a user
652+
653+
ApiResponse[Note] # one note
654+
ApiResponse[list[Note]] # a list
655+
ApiResponse[User] # a user
655656
```
656657

657658
### Q50. pydantic or JSON Schema (jsonschema library)?

‎docs/interview-questions.pdf‎

-73 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)