Skip to content

Commit

Permalink
Merge branch 'hotfix_format_rut_with_dots'
Browse files Browse the repository at this point in the history
  • Loading branch information
gevalenz committed Aug 12, 2021
2 parents b7feced + 5648329 commit 28291a7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.0.1] - 2021-08-12
### Added
- fixes rut formatting functions for inputs containing dash

## [2.0.0] - 2018-12-26
### Added
- format_rut function to get a well formatted RUT
Expand Down
2 changes: 1 addition & 1 deletion rut_chile/rut_chile.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def format_rut_with_dots(rut: str) -> str:
"""
__raise_error_if_rut_input_format_not_valid(rut)
formatted_rut = __clean_rut(rut)
formatted_rut = __add_dash_to_rut(rut)
formatted_rut = __add_dash_to_rut(formatted_rut)
base_rut = __add_thousands_separator(formatted_rut[:-2])
return base_rut + formatted_rut[-2:]

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="rut_chile",
version="2.0.0",
version="2.0.1",
author="Guillermo Valenzuela",
author_email="[email protected]",
description="Package for validating Chilean RUT",
Expand Down
8 changes: 8 additions & 0 deletions tests/test_rut_chile.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ def test_invalid_argument(self, test_input, expected_value):
("12345678", "1.234.567-8"),
("123456789", "12.345.678-9"),
("123456789k", "123.456.789-k"),
("12.667.869-k", "12.667.869-k"),
("12667869-k", "12.667.869-k"),
])
def test_valid_rut(self, test_input, expected_value):
assert rut_chile.format_rut_with_dots(test_input) == expected_value
Expand Down Expand Up @@ -202,6 +204,8 @@ def test_invalid_argument(self, test_input, expected_value):
("12345678", "1.234.567-8"),
("123456789", "12.345.678-9"),
("123456789k", "123.456.789-K"),
("12.667.869-k", "12.667.869-K"),
("12667869-k", "12.667.869-K"),
])
def test_valid_rut(self, test_input, expected_value):
rut = rut_chile.format_capitalized_rut_with_dots(test_input)
Expand Down Expand Up @@ -236,6 +240,8 @@ def test_invalid_argument(self, test_input, expected_value):
("12345678", "1234567-8"),
("123456789", "12345678-9"),
("123456789k", "123456789-k"),
("12.667.869-k", "12667869-k"),
("12667869-k", "12667869-k"),
])
def test_valid_rut(self, test_input, expected_value):
assert rut_chile.format_rut_without_dots(test_input) == expected_value
Expand Down Expand Up @@ -269,6 +275,8 @@ def test_invalid_argument(self, test_input, expected_value):
("12345678", "1234567-8"),
("123456789", "12345678-9"),
("123456789k", "123456789-K"),
("12.667.869-k", "12667869-K"),
("12667869-k", "12667869-K"),
])
def test_valid_rut(self, test_input, expected_value):
rut = rut_chile.format_capitalized_rut_without_dots(test_input)
Expand Down

0 comments on commit 28291a7

Please sign in to comment.