GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add test for function call with non array arguments · yssource/xtensor-python@fe76309

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test_python
    • main.cpp
    • test_pyarray.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test_python/main.cpp‎

Copy file name to clipboardExpand all lines: test_python/main.cpp
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,7 @@ PYBIND11_MODULE(xtensor_python_test, m)
239239
[](C & self) -> C::array_type & { return self.array(); }
240240
)
241241
;
242+
243+
m.def("simple_array", [](xt::pyarray<int>) { return 1; } );
244+
m.def("simple_tensor", [](xt::pytensor<int, 1>) { return 2; } );
242245
}
Collapse file

‎test_python/test_pyarray.py‎

Copy file name to clipboardExpand all lines: test_python/test_pyarray.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ def test_col_row_major(self):
147147
xt.col_major_array(varF)
148148
xt.col_major_array(varF[:, :, 0]) # still col major!
149149

150+
def test_bad_argument_call(self):
151+
with self.assertRaises(TypeError):
152+
xt.simple_array("foo")
153+
154+
with self.assertRaises(TypeError):
155+
xt.simple_tensor("foo")
156+
150157
class AttributeTest(TestCase):
151158

152159
def setUp(self):

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.