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 diffing in test assertion #161

Closed
iamogbz opened this issue Mar 21, 2020 · 1 comment · Fixed by #526
Closed

Snapshot diffing in test assertion #161

iamogbz opened this issue Mar 21, 2020 · 1 comment · Fixed by #526
Labels
feature request New feature or request released

Comments

@iamogbz
Copy link
Collaborator

iamogbz commented Mar 21, 2020

Is your feature request related to a problem? Please describe.

Snapshots should be helpful in indicating at a glance what has changed.

Describe the solution you'd like

def test_my_dict(snapshot):
	my_dict = {
		"field_0": True,
		"field_1": "no_value",
		"nested": {
			"field_0": 1,
		},
	}
	assert my_dict == snapshot(id="case1")
	my_dict["field_1"] = "yes_value"
	assert my_dict == snapshot(diff="case1")
	my_dict["nested"]["field_0"] = 2
	assert my_dict == snapshot(id="case3", diff=1)
# name: test_my_dict.case_1
  <class 'dict'> {
    'field_0': True,
    'field_1': 'no_value',
	'nested': <class 'dict'> {
        'field_0': 1
	},
  }
---
# name: test_my_dict.1
    'field_1': 'yes_value',
---
# name: test_my_dict.case_3
        'field_0': 2
---

Describe alternatives you've considered

N/A

Additional context

@iamogbz iamogbz added the feature request New feature or request label Mar 21, 2020
@iamogbz iamogbz linked a pull request Jun 17, 2021 that will close this issue
3 tasks
@noahnu noahnu added the upvotes required Add thumbs up to this issue if you want to see this feature. label Aug 29, 2021
@noahnu noahnu removed the upvotes required Add thumbs up to this issue if you want to see this feature. label Apr 13, 2022
@tophat-opensource-bot
Copy link
Contributor

🎉 This issue has been resolved in version 2.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants