Skip to content

Commit 3435212

Browse files
committed
Add the Model class and setup tests
1 parent cf6c94e commit 3435212

File tree

8 files changed

+127
-16
lines changed

8 files changed

+127
-16
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
*.DS_store
22
.direnv
33
.venv
4+
__pycache__
5+
.pytest_cache
46
target
57
*.so

source/python/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
default: build
22

3+
# List available targets
4+
help:
5+
@echo "Available targets:"
6+
@echo " default - Run build"
7+
@echo " build - Build this project"
8+
@echo " test - Run tests"
9+
@echo " clean - Delete all build artifacts"
10+
@echo " help - Show this help message"
11+
312
build:
413
uv run --active maturin develop
514

15+
test:
16+
uv run --active pytest
17+
618
clean:
719
rm -rf target
820
rm -rf python/autonomy/*.abi3.so
21+
22+
.PHONY: default help build test clean

source/python/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ python-source = "python"
1919
module-name = "autonomy.autonomy_in_rust_for_python"
2020

2121
[dependency-groups]
22-
dev = ["maturin>=1.9.2"]
22+
dev = [
23+
"maturin>=1.9.2",
24+
"pytest>=8.4.1",
25+
]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from .models import Model
2+
3+
__doc__ = ""
4+
5+
__all__ = [
6+
# from .models
7+
"Model"
8+
]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from .model import Model
2+
3+
__all__ = [
4+
"Model",
5+
]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
class Model:
3+
def __init__(self, name):
4+
self.name = name

source/python/tests/model_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import pytest
2+
3+
from autonomy.models.model import Model
4+
5+
class TestModel:
6+
def test_constructor_sets_name_correctly(self):
7+
expected = "test_model"
8+
model = Model(expected)
9+
assert model.name == expected

source/python/uv.lock

Lines changed: 81 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)