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

refactor utils, add tests, move exceptions into separate module #264

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

demitryfly
Copy link

  • Rewrite find_first_unpair_closed_par and remove_par implementations
  • Add new unit tests
  • Remove redundant (?) SimpleDDLParserException (it's better to discuss, backward compatibility may be broken)
  • Create a separate exception module

@@ -18,44 +35,39 @@ def remove_par(p_list: List[str]) -> List[str]:
}


# TODO: Add tests
Copy link
Author

@demitryfly demitryfly Jun 13, 2024

Choose a reason for hiding this comment

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

I'm gonna add some tests for check_spec function in current PR

@xnuinside
Copy link
Owner

@demitryfly tests failed

"""
Remove the parentheses from the given list

Warn: p_list may contain unhashable types for some unexplored reasons
Copy link
Author

Choose a reason for hiding this comment

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

It's better to find the reason why p_list may contain dict. Is it expected?

Copy link
Owner

Choose a reason for hiding this comment

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

yes, it is expected, p_list contains results of parsing statements, usually it something like {'column': name, 'unique': True}, so p_list - always list, but elements of this list can be dicts

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I rewrote this docstring then.

@demitryfly demitryfly changed the title perform some minor refactorings, add tests refactor utils, add tests Jun 14, 2024
@demitryfly demitryfly changed the title refactor utils, add tests refactor utils, add tests, move exceptions into separate module Jun 14, 2024
@@ -348,7 +346,7 @@ def run(
Dict == one entity from ddl - one table or sequence or type.
"""
if output_mode not in dialect_by_name:
raise SimpleDDLParserException(
Copy link
Author

@demitryfly demitryfly Jun 14, 2024

Choose a reason for hiding this comment

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

I am not sure, if someone uses this exception in their code (to catch it in try-except, for instance). If, it is possible, then it is more correct to make an alias and deprecate it officially.

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.

None yet

2 participants