Skip to content

Commit

Permalink
Use int for IntArrayHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
robertapplin committed Apr 25, 2024
1 parent 0ba036f commit c089110
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -87,8 +87,8 @@ void initArrayLookup(PyArrayIndex &index) {
using StringArrayHandler = SequenceTypeHandler<std::vector<std::string>>;
index.emplace("StringArray", std::make_shared<StringArrayHandler>());

using LongIntArrayHandler = SequenceTypeHandler<std::vector<long>>;
index.emplace("LongIntArray", std::make_shared<LongIntArrayHandler>());
using IntArrayHandler = SequenceTypeHandler<std::vector<int>>;
index.emplace("IntArray", std::make_shared<IntArrayHandler>());
}

/**
Expand Down Expand Up @@ -220,7 +220,7 @@ const std::string PropertyWithValueFactory::isArray(PyObject *const object) {
throw std::runtime_error("Unable to support extracting arrays of booleans.");
}
if (PyLong_Check(item)) {
return std::string("LongIntArray");
return std::string("IntArray");
}
GNU_DIAG_ON("parentheses-equality")
if (PyFloat_Check(item)) {
Expand Down
Expand Up @@ -65,11 +65,11 @@ class PropertyWithValueFactoryTest : public CxxTest::TestSuite {
}

void test_builtin_type_create_long_array_from_list_type_property() {
testCreateArrayProperty<long>(Py_BuildValue("[NN]", PyLong_FromLong(-10), PyLong_FromLong(4)));
testCreateArrayProperty<int>(Py_BuildValue("[NN]", PyLong_FromLong(-10), PyLong_FromLong(4)));
}

void test_builtin_type_create_int_array_from_list_type_property() {
testCreateArrayProperty<long>(Py_BuildValue("[ii]", -10, 4));
testCreateArrayProperty<int>(Py_BuildValue("[ii]", -10, 4));
}

private:
Expand Down

0 comments on commit c089110

Please sign in to comment.