File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
tests/unit/butterfree/automated Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
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" )
You can’t perform that action at this time.
0 commit comments