Skip to content

Commit b947c5e

Browse files
committed
Add pragma no cover
1 parent a8df2f7 commit b947c5e

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

tests/expressions/test_interpreter_coverage4.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
ExpressionsInterpreter,
1414
UnsupportedUnpackingError,
1515
)
16-
from monic.expressions.registry import registry, NamespaceProxy
16+
from monic.expressions.registry import registry, NamespaceProxy, Registry
1717

1818

1919
@pytest.fixture(autouse=True)
@@ -737,16 +737,12 @@ def speak(self):
737737

738738
def test_registry_initialization():
739739
"""Test registry initialization and attributes."""
740-
from monic.expressions.registry import Registry
741-
742740
reg = Registry()
743741
reg.reset()
744742

745743

746744
def test_registry_register_errors():
747745
"""Test error handling in register method."""
748-
from monic.expressions.registry import Registry
749-
750746
reg = Registry()
751747
error1 = ""
752748
error2 = ""
@@ -758,7 +754,7 @@ def test_registry_register_errors():
758754

759755
class NoName:
760756
def __call__(self):
761-
return None
757+
return None # pragma: no cover
762758

763759
obj = NoName()
764760
try:
@@ -772,8 +768,6 @@ def __call__(self):
772768

773769
def test_registry_register_module_errors():
774770
"""Test error handling in register_module method."""
775-
from monic.expressions.registry import Registry
776-
777771
reg = Registry()
778772
error = ""
779773

@@ -787,8 +781,6 @@ def test_registry_register_module_errors():
787781

788782
def test_registry_get_all_errors():
789783
"""Test error handling in get_all method."""
790-
from monic.expressions.registry import Registry
791-
792784
reg = Registry()
793785
error = ""
794786

tests/expressions/test_interpreter_registry.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def test_get_all_with_nested_namespaces():
361361

362362
@register("math.functions.add")
363363
def add(x, y): # pylint: disable=unused-variable
364-
return x + y
364+
return x + y # pragma: no cover
365365

366366
@register("math.constants")
367367
class Constants: # pylint: disable=unused-variable
@@ -383,7 +383,7 @@ def test_register_callable_without_name():
383383
# Create a callable object without __name__ attribute
384384
class CallableWithoutName:
385385
def __call__(self):
386-
pass
386+
pass # pragma: no cover
387387

388388
callable_obj = CallableWithoutName()
389389

@@ -402,7 +402,7 @@ def test_is_registered_with_function():
402402
"""
403403

404404
def test_func():
405-
pass
405+
pass # pragma: no cover
406406

407407
setattr(test_func, "__is_expressions_type__", True)
408408

@@ -423,7 +423,7 @@ def test_register_with_invalid_name():
423423
"""Test that registering with an invalid name type raises ValueError."""
424424

425425
class TestObject:
426-
pass
426+
pass # pragma: no cover
427427

428428
with pytest.raises(ValueError) as exc_info:
429429
registry.register()(TestObject()) # Pass an object without __name__
@@ -481,12 +481,12 @@ def test_get_all_with_mixed_content():
481481
# Register a function in a namespace
482482
@register("utils.helper")
483483
def helper(): # pylint: disable=unused-variable
484-
pass
484+
pass # pragma: no cover
485485

486486
# Register a direct object
487487
@register
488488
def direct_func(): # pylint: disable=unused-variable
489-
pass
489+
pass # pragma: no cover
490490

491491
all_objects = registry.get_all()
492492
assert "math" in all_objects
@@ -500,7 +500,7 @@ def test_is_registered_with_string_name():
500500

501501
@register("test.func")
502502
def test_func(): # pylint: disable=unused-variable
503-
pass
503+
pass # pragma: no cover
504504

505505
assert registry.is_registered("test.func")
506506
assert not registry.is_registered("non.existent.func")
@@ -511,11 +511,11 @@ def test_get_all_with_non_dict_values():
511511

512512
@register("test.value")
513513
def test_func(): # pylint: disable=unused-variable
514-
pass
514+
pass # pragma: no cover
515515

516516
@register("direct_value")
517517
def direct_func(): # pylint: disable=unused-variable
518-
pass
518+
pass # pragma: no cover
519519

520520
register_module("math")
521521

0 commit comments

Comments
 (0)