Unverified Commit d4d05fa0 authored by Thomas J. Fan's avatar Thomas J. Fan Committed by GitHub
Browse files

TST Migrates test_consistency.py to pytest (#3798)

parent 4ae4abbe
......@@ -64,9 +64,7 @@ class FileLoader:
return os.path.join(self.directory, self.prefix + suffix)
class TestEngine(unittest.TestCase):
def test_binary(self):
def test_binary():
fd = FileLoader('../../examples/binary_classification', 'binary')
X_train, y_train, _ = fd.load_dataset('.train')
X_test, _, X_test_fn = fd.load_dataset('.test')
......@@ -78,7 +76,8 @@ class TestEngine(unittest.TestCase):
fd.train_predict_check(lgb_train, X_test, X_test_fn, sk_pred)
fd.file_load_check(lgb_train, '.train')
def test_binary_linear(self):
def test_binary_linear():
fd = FileLoader('../../examples/binary_classification', 'binary', 'train_linear.conf')
X_train, y_train, _ = fd.load_dataset('.train')
X_test, _, X_test_fn = fd.load_dataset('.test')
......@@ -90,7 +89,8 @@ class TestEngine(unittest.TestCase):
fd.train_predict_check(lgb_train, X_test, X_test_fn, sk_pred)
fd.file_load_check(lgb_train, '.train')
def test_multiclass(self):
def test_multiclass():
fd = FileLoader('../../examples/multiclass_classification', 'multiclass')
X_train, y_train, _ = fd.load_dataset('.train')
X_test, _, X_test_fn = fd.load_dataset('.test')
......@@ -101,7 +101,8 @@ class TestEngine(unittest.TestCase):
fd.train_predict_check(lgb_train, X_test, X_test_fn, sk_pred)
fd.file_load_check(lgb_train, '.train')
def test_regression(self):
def test_regression():
fd = FileLoader('../../examples/regression', 'regression')
X_train, y_train, _ = fd.load_dataset('.train')
X_test, _, X_test_fn = fd.load_dataset('.test')
......@@ -113,7 +114,8 @@ class TestEngine(unittest.TestCase):
fd.train_predict_check(lgb_train, X_test, X_test_fn, sk_pred)
fd.file_load_check(lgb_train, '.train')
def test_lambdarank(self):
def test_lambdarank():
fd = FileLoader('../../examples/lambdarank', 'rank')
X_train, y_train, _ = fd.load_dataset('.train', is_sparse=True)
X_test, _, X_test_fn = fd.load_dataset('.test', is_sparse=True)
......@@ -127,7 +129,8 @@ class TestEngine(unittest.TestCase):
fd.train_predict_check(lgb_train, X_test, X_test_fn, sk_pred)
fd.file_load_check(lgb_train, '.train')
def test_xendcg(self):
def test_xendcg():
fd = FileLoader('../../examples/xendcg', 'rank')
X_train, y_train, _ = fd.load_dataset('.train', is_sparse=True)
X_test, _, X_test_fn = fd.load_dataset('.test', is_sparse=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment