Skip to content

Commit 5e65cd1

Browse files
committed
Remove access to __slots__ from unit tests
1 parent 95baa4c commit 5e65cd1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/test_relationship.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import unittest
44
import warnings
5+
import dataclasses
56

67
import pronto
78
from pronto.relationship import Relationship, RelationshipData
@@ -22,8 +23,8 @@ def tearDownClass(cls):
2223
def test_properties(self):
2324
"""Assert the data stored in data layer can be accessed in the view.
2425
"""
25-
for r in RelationshipData.__slots__:
26-
self.assertTrue(hasattr(Relationship, r), f"no property for {r}")
26+
for field in dataclasses.fields(RelationshipData):
27+
self.assertTrue(hasattr(Relationship, field.name), f"no property for {field.name}")
2728

2829
def test_superproperties(self):
2930
ont = pronto.Ontology()

tests/test_term.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import unittest
44
import warnings
5+
import dataclasses
56

67
import pronto
78
from pronto.term import Term, TermData, TermSet
@@ -54,8 +55,8 @@ def test_add_synonym_invalid_type(self):
5455
s = term.add_synonym('instrument type', type=st)
5556

5657
def test_properties(self):
57-
for t in TermData.__slots__:
58-
self.assertTrue(hasattr(Term, t), f"no property for {t}")
58+
for field in dataclasses.fields(TermData):
59+
self.assertTrue(hasattr(Term, field.name), f"no property for {field.name}")
5960

6061
def test_subclasses(self):
6162
term = self.ms["MS:1003025"]

0 commit comments

Comments
 (0)