|
| 1 | +""" |
| 2 | +Copyright OpenSearch Contributors |
| 3 | +SPDX-License-Identifier: Apache-2.0 |
| 4 | +""" |
| 5 | + |
1 | 6 | # Test functions
|
2 | 7 | import os
|
3 | 8 | import sys
|
|
7 | 12 | from types import NoneType
|
8 | 13 |
|
9 | 14 | # Adds parent directory sample_data_tooling to sys.path
|
10 |
| -sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) |
11 |
| -import sample_data_generator.sample_data_generator as generator |
| 15 | +sys.path.append(os.path.abspath(__file__).split("sample_data_tooling")[0]) |
| 16 | +import sample_data_tooling.sample_data_generator.sample_data_generator as generator |
12 | 17 |
|
13 | 18 |
|
14 | 19 | # This path is for getting the parent directory sample_data_generator_tests
|
@@ -78,7 +83,7 @@ def test_valid_choose_field():
|
78 | 83 | assert type(generator.choose_field("keyword", ["email"])) is str
|
79 | 84 | assert "@" in generator.choose_field("keyword", ["email"])
|
80 | 85 | assert type(generator.choose_field("date detection string")) is bool
|
81 |
| - assert type(generator.choose_field("numeric detection string")) is bool |
| 86 | + assert type(generator.choose_field("numeric detection string")) is bool |
82 | 87 | # One of Faker's standard providers
|
83 | 88 | ssn = generator.choose_field("ssn")
|
84 | 89 | assert type(ssn) is str and "-" == ssn[3] and "-" == ssn[6]
|
@@ -158,7 +163,7 @@ def test_valid_generate_data():
|
158 | 163 | test_2 = json.loads(generator.generate_data(valid_json_mapping))
|
159 | 164 | assert len(test_2) == 3
|
160 | 165 | for field in test_2:
|
161 |
| - assert test_2[field] != None |
| 166 | + assert test_2[field] != None |
162 | 167 |
|
163 | 168 | test_3 = json.loads(generator.generate_data(valid_json_string_shorthand, False))
|
164 | 169 | assert len(test_3) == 3
|
|
0 commit comments