コード例 #1
0
class DataframeTest(unittest.TestCase):

    def setUp(self):
        self.p = Projects(os.path.join(TEST_PATH, "other.txt"))
        self.p.clean_up_names()

    def test_get_total(self):
        self.assertEqual(TEST_TOTAL_PROJECTS, str(self.p.total()))

    def test_get_total_percentage(self):
        self.assertEqual(TEST_PERCENTAGE_USER, str(self.p.user_percentage()))

    def test_get_percentage_project(self):
        self.assertEqual(TEST_PERCENTAGE_USER_PROJECT, str(self.p.user_percentage_project("project B")))

    def test_get_average(self):
        self.assertEqual(TEST_AVERAGE_USER, str(self.p.user_average()))

    def test_get_contributor(self):
        self.assertEqual(TEST_CONTRIBUTORS, str(self.p.contributors()))

    def test_get_contributing(self):
        self.assertEqual(TEST_CONTRIBUTING, str(self.p.projects_contributing()))

    def test_get_project_percentage(self):
        self.assertEqual(TEST_PERCENTAGE_PROJECT, str(self.p.projects_percentage()))

    def test_get_project_average(self):
        self.assertEqual(TEST_AVERAGE_PROJECT, str(self.p.projects_average()))
コード例 #2
0
class ParserTest(unittest.TestCase):
    def setUp(self):
        self.p = Projects(TEST_STRING_PROJECTS)

    def test_opendata(self):
        self.assertEqual(TEST_STRING_PROJECTS,
                         read(os.path.join(TEST_PATH, "stats.txt")))

    def test_project_with_path_or_string(self):
        self.assertEqual(
            str(Projects(os.path.join(TEST_PATH, "stats.txt")).df),
            str(self.p.df))

    def test_parsed_project(self):
        self.assertEqual(TEST_LIST_PROJECTS, self.p.raw_project_list)
        self.assertEqual(TEST_DICT_PROJECTS, self.p.projects)
        self.assertEqual(TEST_VALUES_PROJECTS, self.p.values_of("project A"))

    def test_parsed_into_dataframe(self):
        self.assertEqual(TEST_DF_PROJECTS, str(self.p.df))

    def test_cleansed_dataframe(self):
        p = Projects(os.path.join(TEST_PATH, "other.txt"))
        self.assertNotEqual(TEST_COMPLEX_CDF_PROJECTS, str(p.df))
        p.clean_up_names()
        self.assertEqual(TEST_COMPLEX_CDF_PROJECTS, str(p.df))

    def test_number_columns(self):
        self.assertEqual(2, self.p.project_number)
        p = Projects(os.path.join(TEST_PATH, "other.txt"))
        self.assertEqual(3, p.project_number)

    def test_filtered(self):
        self.assertEqual(TEST_FILTERED_DF,
                         str(filter_user(self.p.df, ['dog', 'monkey', 'owl'])))
コード例 #3
0
 def setUp(self):
     self.p = Projects(os.path.join(TEST_PATH, "other.txt"))
     self.p.clean_up_names()
コード例 #4
0
 def setUp(self):
     self.p = Projects(TEST_STRING_PROJECTS)
コード例 #5
0
 def test_number_columns(self):
     self.assertEqual(2, self.p.project_number)
     p = Projects(os.path.join(TEST_PATH, "other.txt"))
     self.assertEqual(3, p.project_number)
コード例 #6
0
 def test_cleansed_dataframe(self):
     p = Projects(os.path.join(TEST_PATH, "other.txt"))
     self.assertNotEqual(TEST_COMPLEX_CDF_PROJECTS, str(p.df))
     p.clean_up_names()
     self.assertEqual(TEST_COMPLEX_CDF_PROJECTS, str(p.df))
コード例 #7
0
 def test_project_with_path_or_string(self):
     self.assertEqual(
         str(Projects(os.path.join(TEST_PATH, "stats.txt")).df),
         str(self.p.df))