iconfinder / pyvat

VAT validation for Python
Other
66 stars 29 forks source link

fix: WIP pin pycountry #50

Closed joshuarli closed 3 years ago

joshuarli commented 3 years ago

pycountry 18.12.8: Switch API from “get + KeyError” to ” get + default=None”. This pins pyvat to that release and makes the appropriate fixes. The next pycountry release, 19.7.15, drops py2, so if pyvat wants upgraded pycountry it'll have to drop py2 as well.

I also cleaned some stuff up and this should supersede https://github.com/iconfinder/pyvat/pull/43, https://github.com/iconfinder/pyvat/pull/48.

edit: Oh, on 2nd look the current code's actually compatible with pycountry 18.12.8+, lol

joshuarli commented 3 years ago

Dang, not really sure why this is failing in 2.7 but not in 3.8.

check_vat_number('..', country_code='..') ... /opt/hostedtoolcache/Python/2.7.18/x64/lib/python2.7/site-packages/unittest2/case.py:826: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if not first == second:
FAILED
check_vat_number('..', country_code=None) ... FAILED
is_vat_number_format_valid('..', country_code='..') ... passed
is_vat_number_format_valid('..', country_code=None) ... passed
======================================================================
1) FAIL: check_vat_number('..', country_code='..')
----------------------------------------------------------------------
   Traceback (most recent call last):
    tests/test_validators.py line 258 in test_dk__country_code
      check_vat_number(vat_number, country_code)
    tests/test_validators.py line 237 in assert_result_equals
      self.assertEqual(expected_address, actual_address)
   AssertionError: '\xc3\x85stvej 1\n7190 billund' != u'\xe5stvej 1\n7190 billund'
joshuarli commented 3 years ago

Uhh, you can ignore this, I realized just now the current code's actually compatible with pycountry 18.12.8+.

Feel free to refer to some of the meta + CI improvements.