def test_d_product(self): """Test the fully contracted product of two d's""" my_color_factor = color.ColorFactor([\ color.ColorString([color.d(1, 2, 3), color.d(1, 2, 3)])]) self.assertEqual(str(my_color_factor.full_simplify()), '(-5 Nc^1 )+(4 1/Nc^1 )+(1 Nc^3 )')
def test_f_d_product(self): """Test the fully contracted product of f and d""" my_color_factor = color.ColorFactor([\ color.ColorString([color.f(1, 2, 3), color.d(1, 2, 3)])]) self.assertEqual(str(my_color_factor.full_simplify()), '')
def setUp(self): """Initialize the ColorString test""" # Create a test color string test_f = color.f(1, 2, 3) test_d = color.d(4, 5, 6) self.my_col_string = color.ColorString([test_f, test_d], coeff=fractions.Fraction(2, 3), Nc_power= -2, is_imaginary=True)
def test_f_d_sum(self): """Test f and d sum with the right weights giving a Tr""" col_str1 = color.ColorString([color.d(1, 2, 3)]) col_str1.coeff = fractions.Fraction(1, 4) col_str2 = color.ColorString([color.f(1, 2, 3)]) col_str2.coeff = fractions.Fraction(1, 4) col_str2.is_imaginary = True my_color_factor = color.ColorFactor([col_str1, col_str2]) self.assertEqual(str(my_color_factor.full_simplify()), '(1 Tr(1,2,3))')
def test_d_object(self): """Test the d color object""" # T should have exactly 3 indices! self.assertRaises(AssertionError, color.d, 1, 2) # Simplify should always return the same ColorFactor my_d = color.d(1, 2, 3) col_str1 = color.ColorString([color.Tr(1, 2, 3)]) col_str2 = color.ColorString([color.Tr(3, 2, 1)]) col_str1.coeff = fractions.Fraction(2, 1) col_str2.coeff = fractions.Fraction(2, 1) self.assertEqual(my_d.simplify(), color.ColorFactor([col_str1, col_str2]))