Skip to content

Commit 5ee9220

Browse files
committed
refactor component; add github actions
1 parent 050d6a8 commit 5ee9220

6 files changed

Lines changed: 52 additions & 27 deletions

File tree

.github/workflows/pyci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Python CI
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: [3.6, 3.7, 3.8]
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Install dependencies
20+
run: |
21+
pip install poetry
22+
make install
23+
- name: Lint and test with pytest
24+
run: |
25+
make

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
[![github action status](https://github.com/hexlet-components/python-points/workflows/Python%20CI/badge.svg)](https://github.com/hexlet-components/python-points/actions)
2+
13
# python-points
24

35
A SICP'ish Points implemented in Python using hexlet-pairs.
46

7+
## Install
8+
9+
```shell
10+
pip install hexlet-points
11+
```
12+
513
## Usage example
614

715
<!-- This code will be doctested. Do not touch the markup! -->
@@ -19,4 +27,4 @@ A SICP'ish Points implemented in Python using hexlet-pairs.
1927

2028
[![Hexlet Ltd. logo](https://raw.githubusercontent.com/Hexlet/hexletguides.github.io/master/images/hexlet_logo128.png)](https://ru.hexlet.io/pages/about)
2129

22-
This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet (in Russian)](https://ru.hexlet.io/pages/about).
30+
This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet (in Russian)](https://ru.hexlet.io/pages/about?utm_source=github&utm_medium=link&utm_campaign=python-points).

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "hexlet-points"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "A SICP'ish Points implemented in Python using hexlet-pairs"
55
authors = ["Hexlet Team <info@hexlet.io>"]
66
license = "ISC"
@@ -24,9 +24,8 @@ python = "^3.6"
2424
hexlet-pairs = "^0.1.0"
2525

2626
[tool.poetry.dev-dependencies]
27-
wemake-python-styleguide = "^0.11.1"
28-
flake8-mypy = "^17.8"
29-
pytest = "^5.0"
27+
pytest = "^5.4.1"
28+
wemake-python-styleguide = "^0.14.0"
3029

3130
[build-system]
3231
requires = ["poetry>=0.12"]

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ ignore =
55
WPS430 # allow nested functions
66
WPS425 # allow bools in args
77
WPS412 # allow __init__.py with logic
8+
DAR101 # allow missing parameters in Dockstring
9+
DAR201 # allow missing Returns in Docstring
810

911
per-file-ignores =
1012
# fix for Emacs's flycheck

test/test_points.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# coding: utf-8
2-
31
"""Tests for hexlet.pairs."""
42

53
from hexlet import points
64

75

86
def test_makeing_and_getting():
97
"""Test make_point + get_x + get_y."""
10-
p = points.make(1, -1)
11-
assert points.get_x(p) == 1, 'Should return a proper X.'
8+
p = points.make(0, -1)
9+
assert points.get_x(p) == 0, 'Should return a proper X.'
1210
assert points.get_y(p) == -1, 'Should return a proper Y.'
1311

1412

@@ -20,17 +18,23 @@ def test_to_string():
2018
)
2119

2220

23-
def test_get_quadrant(): # noqa: WPS210
21+
def test_get_quadrant():
2422
"""Test to_string conversion."""
2523
p1 = points.make(1, 1)
2624
p2 = points.make(-1, 1)
2725
p3 = points.make(-1, -1)
2826
p4 = points.make(1, -1)
29-
px = points.make(0, 1)
30-
py = points.make(1, 0)
3127
assert points.get_quadrant(p1) == 1, 'Should detect a quadrant #1.'
3228
assert points.get_quadrant(p2) == 2, 'Should detect a quadrant #2.'
3329
assert points.get_quadrant(p3) == 3, 'Should detect a quadrant #3.'
3430
assert points.get_quadrant(p4) == 4, 'Should detect a quadrant #4.'
35-
assert points.get_quadrant(px) is None, 'Should handle points on x axis.'
36-
assert points.get_quadrant(py) is None, 'Should handle points on y axis.'
31+
32+
33+
def test_get_quadrant_none():
34+
"""Test to_string conversion."""
35+
pp = points.make(0, 0)
36+
px = points.make(0, 1)
37+
py = points.make(1, 0)
38+
assert not points.get_quadrant(pp), 'Should handle points on origin.'
39+
assert not points.get_quadrant(px), 'Should handle points on x axis.'
40+
assert not points.get_quadrant(py), 'Should handle points on y axis.'

0 commit comments

Comments
 (0)