Skip to content

Commit

Permalink
add tests/test_gen_diff.py, fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
sayat-a committed Jul 18, 2024
1 parent 01cffbc commit 7cbf7bf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
Empty file added tests/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions tests/fixtures/file1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"host": "hexlet.io",
"timeout": 50,
"proxy": "123.234.53.22",
"follow": false
}
5 changes: 5 additions & 0 deletions tests/fixtures/file2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"timeout": 20,
"verbose": true,
"host": "hexlet.io"
}
15 changes: 15 additions & 0 deletions tests/test_gen_diff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from gendiff.gen_diff import generate_diff


def test_generate_diff():
expected_result = """{
- follow: False
host: hexlet.io
- proxy: 123.234.53.22
- timeout: 50
+ timeout: 20
+ verbose: True
}"""
file1_path = 'tests/fixtures/file1.json'
file2_path = 'tests/fixtures/file2.json'
assert generate_diff(file1_path, file2_path) == expected_result

0 comments on commit 7cbf7bf

Please sign in to comment.