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

v.build: added tests for v.build module #5061

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

Conversation

Shreshth-Malik
Copy link
Contributor

This PR introduces tests for the v.build module for various options including build, dump, sdump, cdump, fdump.
The additional text file is used to validate the output.

@github-actions github-actions bot added vector Related to vector data processing Python Related code is in Python module tests Related to Test Suite labels Feb 7, 2025

cls.use_temp_region()
gs.run_command("v.edit", map="test_3x3_map", tool="create", overwrite=True)
gs.run_command("g.region", n=3, s=0, e=3, w=0, res=1)
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to set region for vector processing, it applies to raster operations only

"""Set up a temporary region and create vector map with test features."""

cls.use_temp_region()
gs.run_command("v.edit", map="test_3x3_map", tool="create", overwrite=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use instead something like this:

gs.write_command("v.in.ascii", input="-", stdin=input_data, output=...)

Copy link
Contributor

Choose a reason for hiding this comment

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

Embed this inside the test file, no need to have a separate file. Alternatively it would go in testsuite/data/


# Compare the dictionaries
if self.build_module == self.expected_output:
print("Outputs match!")
Copy link
Contributor

Choose a reason for hiding this comment

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

Use assert methods, not prints

flags="n",
overwrite=True,
)
# Run v.build (with multiple dump options) and store its output in a class variable.
Copy link
Contributor

Choose a reason for hiding this comment

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

Use read_command, the output is not meant to be parsed into a dictionary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Python Related code is in Python tests Related to Test Suite vector Related to vector data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants