🔧 fix(custom_component.py): add line break to improve readability of TODO comment

🔧 fix(index.tsx): remove unused imports to clean up code

🔧 fix(utils.ts): add space before opening parenthesis to improve code style

🔧 fix(test_custom_component.py): add line breaks to improve readability of test cases
This commit is contained in:
gustavoschaedler 2023-07-18 02:05:37 +01:00
commit cee4740b0f
4 changed files with 13 additions and 16 deletions

View file

@ -27,7 +27,8 @@ class CustomComponent(Component):
},
)
# TODO: Create the logic to validate what the Custom Component should have as a prerequisite to be able to execute
# TODO: Create the logic to validate what the Custom Component
# should have as a prerequisite to be able to execute
return True
def is_check_valid(self) -> bool:

View file

@ -3,8 +3,6 @@ import "ace-builds/src-noconflict/ext-language_tools";
import "ace-builds/src-noconflict/mode-python";
import "ace-builds/src-noconflict/theme-github";
import "ace-builds/src-noconflict/theme-twilight";
import "ace-builds/src-noconflict/ext-language_tools";
import "ace-builds/src-noconflict/ace";
// import "ace-builds/webpack-resolver";
import { TerminalSquare } from "lucide-react";
import { ReactNode, useContext, useEffect, useState } from "react";
@ -15,12 +13,6 @@ import { alertContext } from "../../contexts/alertContext";
import { darkContext } from "../../contexts/darkContext";
import { postCustomComponent, postValidateCode } from "../../controllers/API";
import { APIClassType } from "../../types/api";
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from "../../components/ui/tabs";
import BaseModal from "../baseModal";
export default function CodeAreaModal({
@ -48,7 +40,7 @@ export default function CodeAreaModal({
useEffect(() => {
handleClick();
}, [])
}, []);
function handleClick() {
if (!dynamic) {
@ -133,7 +125,7 @@ export default function CodeAreaModal({
</BaseModal.Header>
<BaseModal.Content>
<div className="flex h-full w-full flex-col transition-all">
<div className="h-full w-full">
<div className="h-full w-full">
<AceEditor
value={code}
mode="python"

View file

@ -871,7 +871,7 @@ export function groupByFamily(data, baseClasses, left, type) {
});
}
if(parentOutput !== "custom_components"){
if (parentOutput !== "custom_components") {
let resFil = result.filter((group) => group.family === parentOutput);
result = resFil;
}

View file

@ -94,7 +94,8 @@ def test_component_code_null_error():
def test_component_function_entrypoint_name_null_error():
"""
Test the get_function method raises the ComponentFunctionEntrypointNameNullError when the function_entrypoint_name is empty.
Test the get_function method raises the ComponentFunctionEntrypointNameNullError
when the function_entrypoint_name is empty.
"""
component = Component(code=code_default, function_entrypoint_name="")
with pytest.raises(ComponentFunctionEntrypointNameNullError):
@ -364,7 +365,8 @@ def test_code_parser_parse_function_def_init():
def test_component_get_code_tree_syntax_error():
"""
Test the get_code_tree method of the Component class raises the CodeSyntaxError when given incorrect syntax.
Test the get_code_tree method of the Component class
raises the CodeSyntaxError when given incorrect syntax.
"""
component = Component(code="import os as", function_entrypoint_name="build")
with pytest.raises(CodeSyntaxError):
@ -373,7 +375,8 @@ def test_component_get_code_tree_syntax_error():
def test_custom_component_class_template_validation_no_code():
"""
Test the _class_template_validation method of the CustomComponent class raises the HTTPException when the code is None.
Test the _class_template_validation method of the CustomComponent class
raises the HTTPException when the code is None.
"""
custom_component = CustomComponent(code=None, function_entrypoint_name="build")
with pytest.raises(HTTPException):
@ -407,7 +410,8 @@ class MyMainClass(CustomComponent):
def test_custom_component_get_function_entrypoint_return_type_no_return_type():
"""
Test the get_function_entrypoint_return_type property of the CustomComponent class with a build method with no return type.
Test the get_function_entrypoint_return_type property of the
CustomComponent class with a build method with no return type.
"""
my_code = """
class MyClass(CustomComponent):