-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef017bc
commit 6bdc318
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import unittest | ||
import os | ||
from GHAnalysis import Data | ||
|
||
|
||
class TestGHA(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.data = Data() | ||
self.assertIsInstance(self.data, Data) | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_init(self): | ||
self.data.init('./data') | ||
# 此时数据为 4份2020-01-01-15.json + 1份2015-01-01-15.json | ||
file_exist = all((os.path.exists(f'{i}.pkl') for i in range(3))) | ||
self.assertTrue(file_exist) | ||
|
||
def test_user_event(self): | ||
self.data.load() | ||
num = self.data.user_events.get('waleko', {}).get('PushEvent', 0) | ||
self.assertEqual(num, 8) | ||
|
||
def test_repo_event(self): | ||
self.data.load() | ||
num = self.data.repo_events.get('katzer/cordova-plugin-background-mode', {}).get('PushEvent', 0) | ||
self.assertEqual(num, 0) | ||
|
||
def test_user_repo_event(self): | ||
self.data.load() | ||
num = self.data.user_repo_events.get('cdupuis', {}).get('atomist/automation-client', {}).get('PushEvent', 0) | ||
self.assertEqual(num, 4) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |