Skip to content

Commit

Permalink
Fix #67
Browse files Browse the repository at this point in the history
  • Loading branch information
manycoding committed Apr 16, 2019
1 parent 61cb40f commit 60c8aa8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Note that the top-most release is changes in the unreleased master branch on Git
### Added
- Allow reading private raw schemas directly from bitbucket, #58

### Fixed
- Failing `Compare Prices For Same Urls` when url is `nan`, #67


## [0.3.1] (2019-04-12)

Expand Down
3 changes: 3 additions & 0 deletions src/arche/rules/price.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def compare_prices_for_same_urls(
url_field = url_field[0]
price_field = tagged_fields.get("product_price_field")

source_df = source_df.dropna(subset=[url_field])
target_df = target_df.dropna(subset=[url_field])

same_urls = source_df[(source_df[url_field].isin(target_df[url_field].values))][
url_field
]
Expand Down
13 changes: 11 additions & 2 deletions tests/rules/test_price.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import arche.rules.price as p
from arche.rules.result import Level
from conftest import create_result
import numpy as np
import pandas as pd
import pytest

Expand Down Expand Up @@ -81,8 +82,16 @@ def test_compare_was_now(

compare_prices_inputs = [
(
{"_key": ["1", "0"], "price": [1, "2"], "url": ["http://1", "http://2"]},
{"_key": ["0", "1"], "price": [1.15, "2.3"], "url": ["http://1", "http://2"]},
{
"_key": ["1", "0", "2"],
"price": [1, "2", 5],
"url": ["http://1", "http://2", np.nan],
},
{
"_key": ["0", "1", "2"],
"price": [1.15, "2.3", 6],
"url": ["http://1", "http://2", np.nan],
},
{"product_price_field": ["price"], "product_url_field": ["url"]},
{
Level.INFO: [
Expand Down

0 comments on commit 60c8aa8

Please sign in to comment.