csparpa / pyowm

A Python wrapper around the OpenWeatherMap web API
https://pyowm.readthedocs.io
MIT License
789 stars 171 forks source link

Bug Fixed.Parsing city names with 1 or more commas #346

Closed romanstetsyk closed 3 years ago

romanstetsyk commented 3 years ago

The length of the 'tokens' variable should be 5. City names like "Southern Nations, Nationalities, and People's Region," "Saint Helena, Ascension, and Tristan da Cunha" and a few others were split by a comma into more than 2 parts, causing the 'tokens' length to be more than expected. The longest name is "Villa Presidente Frei, Ñuñoa, Santiago, Chile" (id 7874740). It has three commas, hence split into 4 parts.

csparpa commented 3 years ago

@roman465 thanks! Can you pls add a non-regression unit test for this?

romanstetsyk commented 3 years ago

Hey, I've just added a few unit tests.

csparpa commented 3 years ago

@roman465 thanks!