-
Notifications
You must be signed in to change notification settings - Fork 15
/
testBuildFeats.py
67 lines (45 loc) · 2.76 KB
/
testBuildFeats.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import unittest
from buildFeats import BuildFeatsV2
import os
class TestBuildFeatsV2(unittest.TestCase):
def setUp(self):
unittest.TestLoader.sortTestMethodsUsing = None
self.func = BuildFeatsV2()
def test(self):
self.assertTrue(True)
def test_load_Feats(self):
directory_path = os.getcwd()
self.assertGreater(len(self.func.pf.load_csv(directory_path+"/featscsv/RadGridExport-1.csv")), 0)
def test_norm_name(self):
self.assertEqual(self.func.pf.norm_link("<u><a href=\"Feats.aspx?ID=2516\">Aberration Kinship</a></u>"), "Aberration Kinship")
def test_norm_pfs(self):
self.assertEqual(self.func.pf.norm_pfs("<img alt=\"PFS Standard\" title=\"PFS Standard\" style=\"height:18px; padding:2px 10px 0px 2px\" src=\"Images\Icons\PFS_Standard.png\">"), "PFS Standard")
def test_norm_pfs_neg(self):
self.assertEqual(self.func.pf.norm_pfs("-"), "Excluded")
def test_norm_source(self):
self.assertEqual(self.func.pf.norm_link("<u><a href=\"Sources.aspx?ID=74\" title=\"Ancestry Guide\">Ancestry Guide</a></u>"), "Ancestry Guide")
def test_norm_rarity(self):
self.assertEqual(self.func.pf.norm_link("<u><a href=\"Traits.aspx?ID=28\">Common</a></u>"), "Common")
def test_norm_traits(self):
self.assertEqual(self.func.pf.norm_traits("<u><a href=\"Traits.aspx?ID=338\">Fleshwarp</a></u>"), ['Fleshwarp'])
def test_norm_multi_traits(self):
self.assertEqual(self.func.pf.norm_traits("<u><a href=\"Traits.aspx?ID=215\">Dhampir</a></u>, <u><a href=\"Traits.aspx?ID=317\">Lineage</a></u>"), ['Dhampir', 'Lineage'])
def test_normurl(self):
self.assertEqual(self.func.pf.norm_url("<u><a href=\"Feats.aspx?ID=2516\">Aberration Kinship</a></u>"), "https://2e.aonprd.com/Feats.aspx?ID=2516")
def test_norm_prereqs(self):
self.assertEqual(self.func.pf.norm_prereqs("trained in <u><a href=\"Skills.aspx?ID=8\">Lore</u></a>"), "trained in Lore")
def test_get_details(self):
#print(self.func.get_details("https://2e.aonprd.com/Feats.aspx?ID=779"))
self.assertIsNotNone(self.func.get_details("https://2e.aonprd.com/Feats.aspx?ID=779"))
def test_normalize_feat_data(self):
directory_path = os.getcwd()
self.assertGreater(len(self.func.normalize_feat_data(self.func.pf.load_csv(directory_path+"/featscsv/RadGridExport-1.csv"))), 0)
#def test_build_feats(self):
#self.assertGreater(len(self.func.build_feats()), 0)
#def test_save_feats(self):
##directory_path = os.getcwd()
#self.func.save_feats(self.func.build_feats())
##file = open(directory_path+"/feats-pf2-v3.json", "r")
##self.assertIsNotNone(file)
if __name__ == '__main__':
unittest.main()