I can add new columns
This commit is contained in:
@@ -36,7 +36,7 @@ class MockDataGrid(MultipleInstance):
|
||||
|
||||
def get_table_name(self):
|
||||
return "mock_table"
|
||||
|
||||
|
||||
def get_formula_engine(self):
|
||||
return None
|
||||
|
||||
@@ -163,7 +163,6 @@ class TestDataGridColumnsManagerBehaviour:
|
||||
def test_i_can_update_column_title(self, columns_manager):
|
||||
"""Test updating a column's title via client_response."""
|
||||
columns_manager.save_column_details("name", {"title": "New Name"})
|
||||
|
||||
col_def = columns_manager._get_col_def_from_col_id("name")
|
||||
assert col_def.title == "New Name"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from myfasthtml.core.utils import flatten, make_html_id, pascal_to_snake, snake_to_pascal
|
||||
from myfasthtml.core.utils import flatten, make_html_id, pascal_to_snake, snake_to_pascal, make_unique_safe_id
|
||||
|
||||
|
||||
@pytest.mark.parametrize("input_args,expected,test_description", [
|
||||
@@ -57,6 +57,7 @@ def test_i_can_flatten(input_args, expected, test_description):
|
||||
result = flatten(*input_args)
|
||||
assert result == expected, f"Failed for test case: {test_description}"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("string, expected", [
|
||||
("My Example String!", "My-Example-String_"),
|
||||
("123 Bad ID", "id_123-Bad-ID"),
|
||||
@@ -82,9 +83,9 @@ def test_i_can_have_valid_html_id(string, expected):
|
||||
(" ", "", "only spaces"),
|
||||
])
|
||||
def test_i_can_convert_pascal_to_snake(input_str, expected, test_description):
|
||||
"""Test that pascal_to_snake correctly converts PascalCase/camelCase to snake_case."""
|
||||
result = pascal_to_snake(input_str)
|
||||
assert result == expected, f"Failed for test case: {test_description}"
|
||||
"""Test that pascal_to_snake correctly converts PascalCase/camelCase to snake_case."""
|
||||
result = pascal_to_snake(input_str)
|
||||
assert result == expected, f"Failed for test case: {test_description}"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("input_str, expected, test_description", [
|
||||
@@ -104,6 +105,18 @@ def test_i_can_convert_pascal_to_snake(input_str, expected, test_description):
|
||||
("___", "", "only underscores"),
|
||||
])
|
||||
def test_i_can_convert_snake_to_pascal(input_str, expected, test_description):
|
||||
"""Test that snake_to_pascal correctly converts snake_case to PascalCase."""
|
||||
result = snake_to_pascal(input_str)
|
||||
assert result == expected, f"Failed for test case: {test_description}"
|
||||
"""Test that snake_to_pascal correctly converts snake_case to PascalCase."""
|
||||
result = snake_to_pascal(input_str)
|
||||
assert result == expected, f"Failed for test case: {test_description}"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name, existing_ids, expected", [
|
||||
(None, [], None),
|
||||
("MyClass", [], "myclass"),
|
||||
("MyClass", ["myclass"], "myclass_1"),
|
||||
("MyClass", ["myclass", "myclass_1"], "myclass_2"),
|
||||
])
|
||||
def test_make_unique_safe_id(name, existing_ids, expected):
|
||||
assert make_unique_safe_id(name, existing_ids) == expected, (
|
||||
f"Failed for name: {name}, existing_ids: {existing_ids}, expected: {expected}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user