Skip to content

Commit

Permalink
Added missing test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Oct 14, 2024
1 parent dd1c1f8 commit 5c519bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ pytest-cov = "^4.1.0"
pytest-asyncio = "^0.21.1"
Sphinx = "^7.0.0"
sphinx-copybutton = "^0.5.2"
furo = "^2023.1.1"
sphinx-notfound-page = "^1.0.0"
sphinx-sitemap-lextudio = "^2.5.2"
sphinx-polyversion = "^1.0.0"
furo = "^2023.1.1"
black = "23.1.0"
pre-commit = "2.21.0"
doc8 = "^1.0.0"
sphinx-notfound-page = "^1.0.0"
flake8 = "5.0.4"
flake8 = "^5.0.4"
flake8-import-order = "^0.18.2"
flake8-docstrings = "^1.7.0"
flake8-rst-docstrings = "^0.3.0"
sphinx-polyversion = "^1.0.0"
pep8-naming = "^0.14.1"
cryptography = "^43.0.1"
pysmi = "^1.3.0"
pep8-naming = "^0.14.1"

[tool.poetry_bumpversion.file."pysnmp/__init__.py"]

Expand Down
4 changes: 2 additions & 2 deletions pysnmp/smi/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def get_next_node_name(self, nodeName, modName=""):
oid, label, suffix = self.get_node_name(nodeName, modName)
try:
return self.get_node_name(
self.__mibSymbolsIdx[modName]["oidToLabelIdx"].nextKey(oid) + suffix,
self.__mibSymbolsIdx[modName]["oidToLabelIdx"].next_key(oid) + suffix,
modName,
)
except KeyError:
Expand Down Expand Up @@ -346,7 +346,7 @@ def get_next_type(self, typeName, modName=""):
"""Get next type name."""
m, t = self.get_type_name(typeName, modName)
try:
return self.__mibSymbolsIdx[m]["typeToModIdx"].nextKey(t)
return self.__mibSymbolsIdx[m]["typeToModIdx"].next_key(t)
except KeyError:
raise error.NoSuchObjectError(
str=f"No type next to {modName}::{typeName} at {self}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
from pysnmp.smi import builder, view, rfc1902, error


def test_addAsn1MibSource():
def test_add_asn1_mib_source():
mibBuilder = builder.MibBuilder()
mibView = view.MibViewController(mibBuilder)
mibVar = rfc1902.ObjectIdentity("IF-MIB", "ifInOctets", 1)
mibVar.add_asn1_mib_source("https://mibs.pysnmp.com/asn1/@mib@")
mibVar.resolve_with_mib(mibView)
assert mibVar.prettyPrint() == "IF-MIB::ifInOctets.1"

next_module = mibView.get_next_module_name("IF-MIB")
assert next_module == "SNMPv2-CONF"

oid, label, suffix = mibView.get_first_node_name()
oid, label, suffix = mibView.get_next_node_name(oid)
assert oid == (0, 0)
assert label == ("itu-t", "zeroDotZero")

0 comments on commit 5c519bf

Please sign in to comment.