Skip to content

Commit

Permalink
Fixed erros in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaHobbyist committed Jul 18, 2024
1 parent 11cce23 commit 0b8f76f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pyvnt/Container/list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pyvnt.Reference.basic import *
from pyvnt.Container.Node_C import Foam
from pyvnt.Container.node import Foam
from anytree import Node, RenderTree, AsciiStyle, NodeMixin
from pyvnt.Reference.error_classes import SizeError, NoPlaceholdersError, NoValueError, KeyRepeatError
from pyvnt.utils.make_indent import make_indent
Expand Down
2 changes: 1 addition & 1 deletion pyvnt/Container/list_backup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pyvnt.Reference.basic import *
from pyvnt.Container.Node_C import Foam
from pyvnt.Container.node import Foam
from anytree import Node, RenderTree, AsciiStyle, NodeMixin
from pyvnt.Reference.error_classes import SizeError, NoPlaceholdersError, NoValueError, KeyRepeatError
import warnings
Expand Down
2 changes: 1 addition & 1 deletion pyvnt/Container/node.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from anytree import Node, RenderTree, AsciiStyle, NodeMixin
from anytree.search import find_by_attr
from typing import Any, Type
from pyvnt.Container.Key_C import Key_C
from pyvnt.Container.key import Key_C
from pyvnt.Reference.error_classes import *
from pyvnt.utils.make_indent import make_indent

Expand Down
4 changes: 2 additions & 2 deletions pyvnt/Container/obj_constructor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pyvnt.Container.Node_C import Foam
from pyvnt.Container.Key_C import Key_C
from pyvnt.Container.node import Foam
from pyvnt.Container.key import Key_C

# Function no longer needed
# It is not available to use outside the package and the code is here just for future reference if needed
Expand Down
4 changes: 2 additions & 2 deletions pyvnt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from pyvnt.Reference.vector import *
from pyvnt.Reference.tensor import *
from pyvnt.Reference.dimension_set import Dim_Set_P
from pyvnt.Container.Node_C import *
from pyvnt.Container.Key_C import *
from pyvnt.Container.node import *
from pyvnt.Container.key import *
from pyvnt.Container.list import *
from pyvnt.Converter.Writer.writer import *
from pyvnt.utils import *
Expand Down
2 changes: 1 addition & 1 deletion pyvnt/utils/show_tree.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from anytree import Node, RenderTree, AsciiStyle, NodeMixin
from pyvnt.Container.Node_C import Foam
from pyvnt.Container.node import Foam

def show_tree(head: Foam):
'''
Expand Down
9 changes: 5 additions & 4 deletions tests/test_key.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import pytest

import pyvnt.Container.Key_C as Key_C
from pyvnt.Container.key import Key_C
from pyvnt.Reference.basic import *
from pyvnt.Reference.error_classes import *

class TestKey_C:
def setup_method(self, method):
self.items = {'PCG', 'PBiCG', 'PBiCGStab'}
self.prop2 = Enm_P('val2', items=self.items, default='PBiCG')
self.prop1 = Enm_P('val1', items=self.items, default='PCG')
self.key1 = Key_C.Key_C('solver', self.prop1, self.prop2)
self.key1 = Key_C('solver', self.prop1, self.prop2)

def teardown_method(self, method):
del self.key1
Expand Down Expand Up @@ -42,11 +43,11 @@ def test_Key_C_edit_fail(self):
tmp_prop2 = Int_P('tmpval2', 3, 1, 10)
tmp_prop3 = Int_P('tmpval2', 4, 1, 10)

with pytest.raises(Key_C.KeyRepeatError):
with pytest.raises(KeyRepeatError):
self.key1.replace_val('val1', tmp_prop1)
self.key1.replace_val('val2', tmp_prop1)

with pytest.raises(Key_C.KeyRepeatError):
with pytest.raises(KeyRepeatError):
self.key1.replace_val('val2', tmp_prop2)
self.key1.replace_val('val2', tmp_prop3)

Expand Down

0 comments on commit 0b8f76f

Please sign in to comment.