@@ -51,13 +51,13 @@ def tearDownClass(cls):
51
51
shutil .rmtree (path )
52
52
53
53
def test_default_sentiment (self ):
54
- """ Ensure that the default model predicts something."""
54
+ # Ensure that the default model predicts something
55
55
resp = self .get ("/sentiment?text=This is bad.&text=This is good." , timeout = 60 )
56
56
self .assertEqual (resp .json (), ["NEGATIVE" , "POSITIVE" ])
57
57
58
58
@skipUnless (os .environ .get ("GRAMEX_ML_TESTS" ), "Set GRAMEX_ML_TESTS=1 to run slow ML tests" )
59
59
def test_train_sentiment (self ):
60
- """ Train with some vague sentences."""
60
+ # Train with some vague sentences
61
61
df = pd .read_json ("https://bit.ly/3NesHFs" )
62
62
resp = self .get (
63
63
"/sentiment?_action=train&target_col=label" ,
@@ -69,7 +69,7 @@ def test_train_sentiment(self):
69
69
self .assertGreaterEqual (resp .json ()["score" ], 0.9 )
70
70
71
71
def test_default_ner (self ):
72
- """ Ensure that the default model predicts something."""
72
+ # Ensure that the default model predicts something
73
73
labels = self .get ("/ner?text=Narendra Modi is the PM of India." , timeout = 300 ).json ()
74
74
ents = [[(r ["word" ], r ["entity_group" ]) for r in label ] for label in labels ]
75
75
self .assertIn (("Narendra Modi" , "PER" ), ents [0 ])
@@ -661,7 +661,7 @@ def test_single_line_train_fetch_model(self):
661
661
self .assertIsInstance (model ["DecisionTreeClassifier" ], DecisionTreeClassifier )
662
662
663
663
def test_template (self ):
664
- """ Check if viewing the template works fine."""
664
+ # Check if viewing the template works fine
665
665
r = self .get ("/mlhandler" )
666
666
self .assertEqual (r .status_code , OK )
667
667
# Try getting predictions
@@ -772,7 +772,7 @@ def tearDownClass(cls):
772
772
shutil .rmtree (titanic )
773
773
774
774
def test_default (self ):
775
- """ An empty GET request returns all predictions."""
775
+ # An empty GET request returns all predictions
776
776
y_true = gramex .cache .open (
777
777
op .join (folder , ".." , "testlib" , "iris.csv" ),
778
778
usecols = ["species" ],
@@ -820,7 +820,7 @@ def test_filters(self):
820
820
self .assertEqual (set (y_pred ), {'versicolor' , 'virginica' })
821
821
822
822
def test_from_mlhandler (self ):
823
- """ Check that a model created through MLHandler works."""
823
+ # Check that a model created through MLHandler works
824
824
# Get results from the MLHandler
825
825
df = gramex .cache .open ('titanic.csv' , rel = True )
826
826
resp = self .get (
0 commit comments