Skip to content

Commit 7071978

Browse files
ohmayrhebaalazzeh
authored andcommitted
chore(ndb): restore fail_under=100 in .coveragerc and noxfile (#17771)
Restore coverage for google-cloud-ndb Towards #17459 🦕
1 parent e6f4960 commit 7071978

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

packages/google-cloud-ndb/.coveragerc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22
branch = True
33

44
[report]
5-
fail_under = 99
5+
fail_under = 100
66
show_missing = True
77
exclude_lines =
88
# Re-enable the standard pragma
99
pragma: NO COVER
10+
# Ignore debug-only repr
11+
def __repr__
12+
# Ignore abstract methods
13+
raise NotImplementedError
14+
# Ignore defensive assertions
15+
raise TypeError
1016
omit =
1117
.nox/*
1218
*/gapic/*.py
1319
*/proto/*.py
14-
tests/*/*.py
20+
tests/*
21+
*/tests/*

packages/google-cloud-ndb/tests/unit/test__gql.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,3 +715,17 @@ def test_user():
715715
def test_nop():
716716
with pytest.raises(NotImplementedError):
717717
gql_module.FUNCTIONS["nop"]("any arg")
718+
719+
@staticmethod
720+
def test_time_2_args_and_invalid():
721+
import datetime
722+
723+
assert gql_module._time_function([10, 30]) == datetime.time(10, 30)
724+
with pytest.raises(exceptions.BadQueryError):
725+
gql_module._time_function([])
726+
727+
@staticmethod
728+
def test_ancestor_condition_not_is():
729+
gql = gql_module.GQL("SELECT * FROM Kind")
730+
with pytest.raises(ValueError, match="condition must be 'is'"):
731+
gql._AddProcessedParameterFilter("ancestor", "!=", "nop", ["param"])

packages/google-cloud-ndb/tests/unit/test_model.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6658,3 +6658,17 @@ class ManyFields(model.Model):
66586658
unused = model.FloatProperty()
66596659

66606660
return ManyFields
6661+
6662+
6663+
def test_model_set_projection_branches():
6664+
class Child(model.Model):
6665+
val = model.StringProperty()
6666+
6667+
class Parent(model.Model):
6668+
child = model.StructuredProperty(Child)
6669+
children = model.StructuredProperty(Child, repeated=True)
6670+
6671+
parent = Parent(child=Child(val="a"), children=[Child(val="b")])
6672+
parent._set_projection(["child.val", "children.val", "nonexistent.subprop"])
6673+
parent._properties = None
6674+
parent._set_projection(["child.val"])

0 commit comments

Comments
 (0)