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

Reformatting, cleanup, and coverage #193

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

Conversation

justinvanwinkle
Copy link

No description provided.

@codecov
Copy link

codecov bot commented Aug 15, 2020

Codecov Report

Merging #193 into master will decrease coverage by 0.09%.
The diff coverage is 89.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #193      +/-   ##
==========================================
- Coverage   98.93%   98.84%   -0.10%     
==========================================
  Files          26       26              
  Lines        4052     4053       +1     
  Branches      575      573       -2     
==========================================
- Hits         4009     4006       -3     
- Misses         20       24       +4     
  Partials       23       23              
Impacted Files Coverage Δ
glom/grouping.py 98.08% <ø> (-0.64%) ⬇️
glom/streaming.py 100.00% <ø> (ø)
glom/test/test_error.py 99.54% <ø> (-0.01%) ⬇️
glom/cli.py 85.38% <33.33%> (-0.67%) ⬇️
glom/test/test_mutation.py 97.93% <50.00%> (-0.02%) ⬇️
glom/matching.py 99.58% <80.00%> (-0.42%) ⬇️
glom/core.py 98.86% <100.00%> (-0.01%) ⬇️
glom/mutation.py 98.67% <100.00%> (ø)
glom/reduction.py 100.00% <100.00%> (ø)
glom/test/test_basic.py 100.00% <100.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d99ccaa...6451e98. Read the comment docs.

Copy link
Owner

@mahmoud mahmoud left a comment

Choose a reason for hiding this comment

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

I'm +0 on a few of these, +1 on most. A few things need addressing, however, like the test_basic imports. Maybe we do a separate file that's just for importing from the public API so it's clearer?

Also, while you're at it, do a fave and # pragma: no cover branches called out by codecov in the diff. If we're gonna touch a bunch of lines, might as well make sure they're either covered or explicitly uncovered.

Thanks!

@@ -337,7 +336,7 @@ def none_or(sub_schema):
'allow None or sub_schema'
return Match(Or(None, sub_schema))

assert glom(None, none_or('abc')) == None
assert glom(None, none_or('abc')) == None # noqa: E711
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
assert glom(None, none_or('abc')) == None # noqa: E711
assert glom(None, none_or('abc')) is None

Copy link
Owner

Choose a reason for hiding this comment

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

basically, the ones related to matching have to do == bc you can't override is. But this one, pretty sure could be an is. :)

@@ -454,17 +454,19 @@ def test_check_ported_tests():
assert glom(target, M(T)) == ['1']

failing_checks = [({'a': {'b': 1}}, {'a': ('a', 'b', Match(str))},
'''expected type str, not int'''), # TODO: bbrepr at least, maybe include path like Check did
# TODO: bbrepr at least, maybe include path like Check did
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
# TODO: bbrepr at least, maybe include path like Check did
# TODO: maybe include path like Check did

ok_target = lambda: None

def ok_target():
return None
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
return None
return None # pragma: no cover

from glom import glom, SKIP, STOP, Path, Inspect, Coalesce, CoalesceError, Val, Call, T, S, Invoke, Spec, Ref
from glom import Auto, Fill, Iter, A, Vars, Val, Literal, GlomError, Pipe
from glom import glom, SKIP, STOP, Inspect, Coalesce, Val, Call, T, S, Invoke, Spec, Ref
from glom import Fill, Iter, Literal, Pipe
Copy link
Owner

Choose a reason for hiding this comment

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

ah, these imports are to ensure we don't regress the init of the module itself, I don't think we want to remove them.


from glom import OMIT, Let, Literal # backwards compat
from glom import OMIT # backwards compat
Copy link
Owner

Choose a reason for hiding this comment

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

same with the backwards compat ones here. they can probably move up close to the other public ones, but keep the comment.

).star(args='args2', kwargs='kwargs')
spec = (Invoke(test).star(args='args')
.constants(3, b='b').specs(c='c')
.star(args='args2', kwargs='kwargs'))
Copy link
Owner

Choose a reason for hiding this comment

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

this is better than the one before, but i think one per line might read nice here.

@mahmoud mahmoud changed the title tabs and spaces? Reformatting, cleanup, and coverage Aug 15, 2020
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.

2 participants