Skip to content

Commit

Permalink
Merge pull request #16 from Point72/tkp/make
Browse files Browse the repository at this point in the history
Fix test alias
  • Loading branch information
timkpaine authored Nov 29, 2024
2 parents fde5693 + 6a93965 commit 94941d0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ install: ## install to site-packages
test: ## run the python unit tests
python -m pytest -v ccflow/tests --cov=ccflow --cov-report xml --cov-report term-missing

test: tests
tests: test

###########
# Linting #
Expand Down
2 changes: 1 addition & 1 deletion ccflow/tests/result/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ def test_generics_conversion(self):
self.assertEqual(GenericResult[int](value=GenericContext[str](value=v)), GenericResult[int](value=v))
self.assertEqual(GenericResult[int](value=GenericContext[int](value=v)), GenericResult[int](value=v))

self.assertEqual(GenericResult[str].validate(GenericContext(value=5)), GenericResult[str](value="5"))
self.assertEqual(GenericResult[str].model_validate(GenericContext(value=5)), GenericResult[str](value="5"))
8 changes: 2 additions & 6 deletions ccflow/tests/test_base_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,8 @@ def test_numpy_serialize(self):
self._check_serialization(H(arr=[1, 0]), self._numpy_equality)

self._check_serialization(F(arr=["passes"]), self._numpy_equality)
self.assertRaises(
Exception,
self._check_serialization,
H_complex64(arr=[11, 12]),
self._numpy_equality,
)

self._check_serialization(H_complex64(arr=[11, 12]), self._numpy_equality)

cut_off_array = H_int8(arr=[127, -128])
np.testing.assert_array_equal(cut_off_array.arr, np.array([127, -128], dtype=np.int8))
Expand Down
1 change: 1 addition & 0 deletions ccflow/tests/test_lazy_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class MyResult(ResultBase):
def _validate(self):
# Track construction by incrementing the total each time the validation is called
MyResult.total += 1
return self


def test_make_lazy_result():
Expand Down
16 changes: 8 additions & 8 deletions ccflow/tests/utils/test_chunker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

class TestChunker(unittest.TestCase):
def test_dates_to_chunks_M(self):
out = dates_to_chunks(date(2022, 4, 6), date(2022, 4, 7), "M")
out = dates_to_chunks(date(2022, 4, 6), date(2022, 4, 7), "ME")
self.assertListEqual(out, [(date(2022, 4, 1), date(2022, 4, 30))])

out = dates_to_chunks(date(2022, 4, 1), date(2022, 4, 30), "M")
out = dates_to_chunks(date(2022, 4, 1), date(2022, 4, 30), "ME")
self.assertListEqual(out, [(date(2022, 4, 1), date(2022, 4, 30))])

out = dates_to_chunks(date(2022, 3, 6), date(2022, 4, 7), "M")
out = dates_to_chunks(date(2022, 3, 6), date(2022, 4, 7), "ME")
self.assertListEqual(
out,
[
(date(2022, 3, 1), date(2022, 3, 31)),
(date(2022, 4, 1), date(2022, 4, 30)),
],
)
out = dates_to_chunks(date(2022, 1, 6), date(2022, 4, 7), "M")
out = dates_to_chunks(date(2022, 1, 6), date(2022, 4, 7), "ME")
self.assertListEqual(
out,
[
Expand Down Expand Up @@ -65,21 +65,21 @@ def test_dates_to_chunks_d(self):
self.assertListEqual(out, [])

def test_dates_to_chunks_trim(self):
out = dates_to_chunks(date(2022, 4, 6), date(2022, 4, 7), "M", trim=True)
out = dates_to_chunks(date(2022, 4, 6), date(2022, 4, 7), "ME", trim=True)
self.assertListEqual(out, [(date(2022, 4, 6), date(2022, 4, 7))])

out = dates_to_chunks(date(2022, 4, 1), date(2022, 4, 30), "M", trim=True)
out = dates_to_chunks(date(2022, 4, 1), date(2022, 4, 30), "ME", trim=True)
self.assertListEqual(out, [(date(2022, 4, 1), date(2022, 4, 30))])

out = dates_to_chunks(date(2022, 3, 6), date(2022, 4, 7), "M", trim=True)
out = dates_to_chunks(date(2022, 3, 6), date(2022, 4, 7), "ME", trim=True)
self.assertListEqual(
out,
[
(date(2022, 3, 6), date(2022, 3, 31)),
(date(2022, 4, 1), date(2022, 4, 7)),
],
)
out = dates_to_chunks(date(2022, 1, 6), date(2022, 4, 7), "M", trim=True)
out = dates_to_chunks(date(2022, 1, 6), date(2022, 4, 7), "ME", trim=True)
self.assertListEqual(
out,
[
Expand Down

0 comments on commit 94941d0

Please sign in to comment.