2a14a7298f88cf1d982281291362d143c044c398,tests/python/pants_test/util/test_objects.py,TypedDatatypeTest,test_instance_construction_by_repr,#TypedDatatypeTest#,364

Before Change


    self.assertEqual(some_object.an_int, 45)
    self.assertEqual(repr(some_object),
                     "WithExplicitTypeConstraint(a_string="asdf", an_int=45)")
    self.assertEqual(
      str(some_object),
      "WithExplicitTypeConstraint(a_string<=str>=asdf, an_int<=int>=45)")

    some_nonneg_int = NonNegativeInt(an_int=3)
    self.assertEqual(3, some_nonneg_int.an_int)
    self.assertEqual(repr(some_nonneg_int), "NonNegativeInt(an_int=3)")

After Change


    def compare_string_rep(string_type):
      expected_message = "MixedTyping(value=3, name<={0}>=asdf)".format(string_type)
      self.assertEqual(str(mixed_type_obj), expected_message)
    if "newstr" in str(mixed_type_obj):  // Python2
      compare_string_rep("newstr")
    else:  // Python3
      compare_string_rep("str")

    subclass_constraint_obj = WithSubclassTypeConstraint(SomeDatatypeClass())
    self.assertEqual("asdf", subclass_constraint_obj.some_value.something())
    self.assertEqual(repr(subclass_constraint_obj),
                     "WithSubclassTypeConstraint(some_value=SomeDatatypeClass())")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: pantsbuild/pants
Commit Name: 2a14a7298f88cf1d982281291362d143c044c398
Time: 2018-07-06
Author: ericarellano@me.com
File Name: tests/python/pants_test/util/test_objects.py
Class Name: TypedDatatypeTest
Method Name: test_instance_construction_by_repr


Project Name: pantsbuild/pants
Commit Name: 2a14a7298f88cf1d982281291362d143c044c398
Time: 2018-07-06
Author: ericarellano@me.com
File Name: tests/python/pants_test/util/test_objects.py
Class Name: TypedDatatypeTest
Method Name: test_type_check_errors


Project Name: pantsbuild/pants
Commit Name: 2a14a7298f88cf1d982281291362d143c044c398
Time: 2018-07-06
Author: ericarellano@me.com
File Name: tests/python/pants_test/util/test_objects.py
Class Name: TypedDatatypeTest
Method Name: test_mixin_type_construction


Project Name: pantsbuild/pants
Commit Name: 2a14a7298f88cf1d982281291362d143c044c398
Time: 2018-07-06
Author: ericarellano@me.com
File Name: tests/python/pants_test/util/test_objects.py
Class Name: TypedDatatypeTest
Method Name: test_class_construction_errors