Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unittests #29

Draft
wants to merge 30 commits into
base: master
Choose a base branch
from
Draft

Add unittests #29

wants to merge 30 commits into from

Conversation

strump
Copy link
Collaborator

@strump strump commented Nov 19, 2024

  • Phase 1: cover kothic with unittests
  • Phase 2: add type annotations to arguments and fields, also migrate to f"" strings
  • Phase 3: small refactoring, no new features
  • Phase 4: ???

Here I'm covering all base classes Rule, Condition, MapCSS, Eval, libkomwm.py with unit-tests to make sure nothing will brake on new changes.

Work in progress.

@@ -24,7 +24,7 @@ def __init__(self, typez, params):
params = (params,)
self.params = params # e.g. ('highway','primary')
if typez == "regex":
self.regex = re.compile(self.params[0], re.I)
self.regex = re.compile(self.params[1], re.I)
Copy link
Collaborator Author

@strump strump Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I fixed bug with regex conditions: [natural=~/water.+/]. Organic Maps never used such conditions in MapCSS styles.
Should we remove regex conditions completely from the kothic?

import logging

logger = logging.getLogger('mapcss.Eval')
logger.setLevel(logging.ERROR)

class Eval():
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is responsible for eval(...) expressions in .mapcss files. But Organic Maps never used evals in styles.
Should we remove eval completely from the project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant