Skip to content

Commit

Permalink
[TEST] Don't import tests from another package
Browse files Browse the repository at this point in the history
  • Loading branch information
stuart-cls committed Nov 19, 2024
1 parent 74184e4 commit 25491c3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dist
*.o
*.py[doc]
MANIFEST
.tox

# Cython generated files
__pycache__
Expand All @@ -22,6 +23,7 @@ __pycache__

# Coverage reports
htmlcov/*
.coverage

# check_pylint_diff
.pylint_cache
Expand Down
29 changes: 27 additions & 2 deletions orangecontrib/protospec/tests/test_io.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
import unittest

import numpy as np
from Orange.data import (
Domain,
DiscreteVariable,
ContinuousVariable,
StringVariable,
Table,
)

from Orange.data.tests.test_io import TestWriters
from Orange.tests import named_file

from orangecontrib.protospec.data import HDF5Reader


class TestHDF5(TestWriters):
class TestHDF5(unittest.TestCase):
# From Orange.data.test.test_io.TestWriters
def setUp(self):
self.domain = Domain(
[
DiscreteVariable("a", values=tuple("xyz")),
ContinuousVariable("b", number_of_decimals=3),
],
ContinuousVariable("c", number_of_decimals=0),
[StringVariable("d")],
)
self.data = Table.from_numpy(
self.domain,
np.array([[1, 0.5], [2, np.nan], [np.nan, 1.0625]]),
np.array([3, 1, 7]),
np.array([["foo", "bar", np.nan]], dtype=object).T,
)

def test_roundtrip_hdf5(self):
with named_file('', suffix='.hdf5') as fn:
HDF5Reader.write(fn, self.data)
Expand Down

0 comments on commit 25491c3

Please sign in to comment.