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

Snapshot test with pytest #56

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unneccesary test
hamidhajiparvaneh committed Aug 16, 2024
commit d8efbfa45cf520d90114a0ba21a9e6958f2eb620
31 changes: 0 additions & 31 deletions unittests/__snapshots__/test_duplicates.ambr
Original file line number Diff line number Diff line change
@@ -419,37 +419,6 @@

'''
# ---
# name: TestRemoveDuplicateDefinitions.test_remove_duplicate_definitions[no_duplicates_bo\TestDuplicates.cs]
'''

namespace BO4EDotNet
{
public partial class TestClass
{
// Original content
}

public partial class TestClass
{
// Duplicate content
}

public enum TestEnum
{
Value1,
Value2
}

public enum TestEnum
{
Value1,
Value2,
Value3
}
}

'''
# ---
# name: TestRemoveDuplicateDefinitions.test_remove_duplicate_definitions[no_duplicates_com\Adresse.cs]
'''
// <auto-generated />
3,640 changes: 0 additions & 3,640 deletions unittests/__snapshots__/test_generator.ambr

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions unittests/test_generator.py
Original file line number Diff line number Diff line change
@@ -69,22 +69,6 @@ def test_generate_csharp_classes_snapshot(
content = f.read()
assert content == snapshot(name=str(relative_path))

def test_remove_duplicate_definitions(
self, test_data_root, schemas_dir, output_dir, quicktype_executable, snapshot: SnapshotAssertion
):
"""
Test case for removing duplicate definitions from generated C# classes.
"""
generator.generate_csharp_classes(test_data_root, schemas_dir, output_dir, quicktype_executable)
remove_duplicate_definitions(output_dir)

generated_files = sorted(output_dir.glob("**/*.cs"))
for file in generated_files:
relative_path = file.relative_to(output_dir)
with file.open("r", encoding="utf-8") as f:
content = f.read()
assert content == snapshot(name=f"no_duplicates_{relative_path}")

def test_cli_main(self, schemas_dir, output_dir, snapshot: SnapshotAssertion):
"""
Test case for the CLI main function.