feat: convert PyVector properties to use macros

Properties x and y now use MCRF_PROPERTY for consistency.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
John McCardle 2025-10-30 11:33:49 -04:00
parent 07e8207a08
commit a8a257eefc
2 changed files with 16 additions and 2 deletions

View File

@ -4,8 +4,10 @@
#include <cmath>
PyGetSetDef PyVector::getsetters[] = {
{"x", (getter)PyVector::get_member, (setter)PyVector::set_member, "X/horizontal component", (void*)0},
{"y", (getter)PyVector::get_member, (setter)PyVector::set_member, "Y/vertical component", (void*)1},
{"x", (getter)PyVector::get_member, (setter)PyVector::set_member,
MCRF_PROPERTY(x, "X coordinate of the vector (float)"), (void*)0},
{"y", (getter)PyVector::get_member, (setter)PyVector::set_member,
MCRF_PROPERTY(y, "Y coordinate of the vector (float)"), (void*)1},
{NULL}
};

View File

@ -23,5 +23,17 @@ assert "Return a unit vector" in normalize_doc
assert "Returns:" in normalize_doc
assert "Note:" in normalize_doc
# Check Vector.x property docstring
x_doc = mcrfpy.Vector.x.__doc__
print("x property doc:", x_doc)
assert "X coordinate of the vector" in x_doc
assert "float" in x_doc
# Check Vector.y property docstring
y_doc = mcrfpy.Vector.y.__doc__
print("y property doc:", y_doc)
assert "Y coordinate of the vector" in y_doc
assert "float" in y_doc
print("SUCCESS: All docstrings present and complete")
sys.exit(0)