forked from alecgoedinghaus/match-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_matching.py
More file actions
27 lines (18 loc) · 963 Bytes
/
test_matching.py
File metadata and controls
27 lines (18 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import from_sheets
import matcher
import pandas as pd
def test_sheet_to_df():
returned_df = from_sheets.survey_to_df()
assert all(
[expected_q in returned_df.columns for expected_q in matcher.CATEGORICAL_QUESTIONS])
TEST_SURVEY_DATA = pd.DataFrame(data={"Timestamp": ["12/31/31", "12/31/31", "12/31/31", "12/31/31"], "ID": ["1", "2", "3", "4"], "Hello": ["not", "a", "valid", "question"], "To be or not to be?": [
"Y", "N", "N", "Y"], "Favorite number between 1 and 2?": ["1", "1", "2", "2"]})
def test_pop_categorical():
global TEST_SURVEY_DATA
matcher.populate_categorical(TEST_SURVEY_DATA)
assert matcher.CATEGORICAL_QUESTIONS == [
"To be or not to be?", "Favorite number between 1 and 2?"]
def test_convert_cat():
global TEST_SURVEY_DATA
dummies = matcher.convert_categorical(TEST_SURVEY_DATA)
assert all([di == i for di, i in zip(dummies.index, ["1", "2", "3", "4"])])