Beispiel #1
0
 def test_get_in_and_out_degrees_bad_mod_throws(self):
     with self.assertRaises(ValueError) as context:
         get_in_and_out_degrees(
             [['1', '2', '4'], ['2', '4', '2'], ['1', '2', '4']], 7)
     self.assertEqual(
         'The number of total accounts (7) must be a multiple of the degree sequence length (4).',
         str(context.exception))
Beispiel #2
0
 def test_get_in_and_out_degrees_unequal_degrees_throws(self):
     with self.assertRaises(ValueError) as context:
         get_in_and_out_degrees(
             [['1', '2', '4'], ['2', '4', '2'], ['1', '2', '3']], 8)
     self.assertEqual(
         'The sum of in-degree (12) and out-degree (11) must be same.',
         str(context.exception))
Beispiel #3
0
 def test_get_in_and_out_degrees_padding(self):
     result = get_in_and_out_degrees(
         [['1', '2', '4'], ['2', '4', '2'], ['1', '2', '4']], 8)
     self.assertEqual(result,
                      ([2, 4, 4, 2, 2, 4, 4, 2], [4, 2, 2, 4, 4, 2, 2, 4]))