Skip to content

Commit fe2df9d

Browse files
committed
Initial commit
0 parents  commit fe2df9d

9 files changed

Lines changed: 309 additions & 0 deletions

File tree

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Data Platform Team
2+
* @oaknorthbank/data-platform

.github/settings.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
repository:
3+
# See https://github.com/apps/settings for all available settings.
4+
name: python-pairing-exercise
5+
description: null
6+
topics: squad-cards, mission-spend, product-transactional-bank, environment-sandbox
7+
8+
teams:
9+
- name: data-platform
10+
permission: admin

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
__pycache__/

Pipfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
pytest = "*"
8+
black = "*"
9+
autoflake = "*"
10+
isort = "*"
11+
flake8 = "*"
12+
freezegun = "*"
13+
14+
[scripts]
15+
format = "bash -c \"autoflake --remove-all-unused-imports -i -r . && isort . && black .\""

Pipfile.lock

Lines changed: 219 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Pairing Exercise: Python
2+
========================
3+
4+
This is a pairing exercise for prospective data engineers with a focus on Python.
5+
6+
The candidate should guide the exercise and do as much as is feasible within the time limit (~30-35 minutes).
7+
8+
## Workflow
9+
10+
The candidate can choose to use any tools, IDEs and editors they like and is expected to have some setup to be able to share their screen and write Python code.
11+
12+
The pairing exercise should be run following [Test-Driven Development (TDD)](https://en.wikipedia.org/wiki/Test-driven_development). The candidate doesn't need to have previous TDD experience, but some understanding of what it is at high level can be helpful.
13+
14+
The main idea is to start by writing a failing test with the expected behaviour of the code, and then work on it until the test passes.
15+
16+
## Setup
17+
18+
The exercise should not require the use of any external dependencies except for `pytest` to run the tests.
19+
20+
If using `pipenv`:
21+
22+
```bash
23+
pipenv install --dev
24+
pipenv run pytest .
25+
```
26+
27+
Alternatively, if `pipenv` is not installed:
28+
29+
```bash
30+
pip install pytest
31+
pytest .
32+
```

consumer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def consume_invoices(invoices):
2+
pass

invoices.csv

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
id,organisation_id,raised_date,due_date,paid_date,status,amount
2+
1,1000,2019-10-10,2019-10-20,2019-10-15,PAID,1000
3+
2,1000,2019-10-10,2019-10-20,2019-11-10,PAID,2000
4+
3,1000,2019-10-10,2019-10-30,,UNPAID,1500
5+
4,1000,2019-10-10,2019-11-20,,UNPAID,2000
6+
5,1000,2019-10-10,2019-11-01,2019-11-05,PAID,3000
7+
6,2000,2019-09-10,2019-10-10,2019-10-10,PAID,1000
8+
7,2000,2019-09-10,2019-10-20,2019-10-30,PAID,2000
9+
8,2000,2019-09-10,2019-11-10,2019-11-10,PAID,4000
10+
9,2000,2019-09-10,2019-11-20,,UNPAID,5000
11+
10,2000,2019-09-10,2021-12-30,,UNPAID,1000
12+
11,2000,2019-09-10,2019-12-20,2019-09-20,PAID,2000

test_consumer.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from csv import DictReader
2+
3+
import pytest
4+
5+
from consumer import consume_invoices
6+
7+
8+
@pytest.fixture
9+
def invoices():
10+
with open("invoices.csv") as f:
11+
yield list(DictReader(f))
12+
13+
14+
def test_empty_list():
15+
consume_invoices([])

0 commit comments

Comments
 (0)