Пример #1
0
    def test_Q3_2(self):
        result = self.pretty_rdd(
            get_in_degrees(
                convert_to_weighted_network(
                    extract_email_network(
                        self.utf8_decode_and_filter(
                            self.sc.sequenceFile(
                                '/user/ufac001/project1920/samples/enron20.seq'
                            ))))))

        self.assertEqual(
            result, '''
        (15, '*****@*****.**')
        (9, '*****@*****.**')
        (4, '*****@*****.**')
        (4, '*****@*****.**')
        (3, '*****@*****.**')
        (3, '*****@*****.**')
        (2, '*****@*****.**')
        (1, '*****@*****.**')
        (1, '*****@*****.**')
        (1, '*****@*****.**')
        (1, '*****@*****.**')
        (1, '*****@*****.**')
        (1, '*****@*****.**')
        (1, '*****@*****.**')
        (1, '*****@*****.**')
        (1, '*****@*****.**')
        (1, '*****@*****.**')
        (0, '*****@*****.**')
        (0, '*****@*****.**')
        (0, '*****@*****.**')
        (0, '*****@*****.**')
        (0, '*****@*****.**')
        (0, '*****@*****.**')
        (0, '*****@*****.**')
        (0, '*****@*****.**')
        ''')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')
# (0, '*****@*****.**')

    
    print(pretty_rdd(get_in_degrees(convert_to_weighted_network(rdd))))
# Expected output
# (15, '*****@*****.**')
# (9, '*****@*****.**')
# (4, '*****@*****.**')
# (4, '*****@*****.**')
# (3, '*****@*****.**')
# (3, '*****@*****.**')
# (2, '*****@*****.**')
# (1, '*****@*****.**')
# (1, '*****@*****.**')
# (1, '*****@*****.**')
# (1, '*****@*****.**')
# (1, '*****@*****.**')
# (1, '*****@*****.**')
# (1, '*****@*****.**')