Skip to content

Commit 27634ce

Browse files
committed
feat(updating-auto-fs-creation): add unit test
1 parent c441c8f commit 27634ce

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/unit/butterfree/automated/__init__.py

Whitespace-only changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import unittest
2+
from unittest.mock import MagicMock, patch
3+
4+
from butterfree.automated.feature_set_creation import FeatureSetCreation
5+
6+
7+
class TestFeatureSetCreation(unittest.TestCase):
8+
def setUp(self):
9+
self.feature_set_creation = FeatureSetCreation()
10+
11+
def test_get_features_with_regex(self):
12+
sql_query = "SELECT column1, column2 FROM table1"
13+
expected_features = ["column1", "column2"]
14+
15+
features = self.feature_set_creation._get_features_with_regex(sql_query)
16+
17+
self.assertEqual(features, expected_features)
18+
19+
def test_get_data_type(self):
20+
field_name = "column1"
21+
df_mock = MagicMock()
22+
df_mock.schema.jsonValue.return_value = {
23+
"fields": [{"name": "column1", "type": "string"}]
24+
}
25+
26+
data_type = self.feature_set_creation._get_data_type(field_name, df_mock)
27+
28+
self.assertEqual(data_type, ".STRING")

0 commit comments

Comments
 (0)