示例#1
0
def func2():
    _ = debugtrace.enter()  # ToDo: Remove after debugging
    contacts = [
        Contact(1, 'Akane', 'Apple', datetime.date(1991, 2, 3)),
        Contact(2, 'Yukari', 'Apple', datetime.date(1992, 3, 4))
    ]
    debugtrace.print('contacts', contacts)  # ToDo: Remove after debugging
示例#2
0
 def func1(self) -> None:
     _ = debugtrace.enter()
     debugtrace.print('value', 1)
     self.assertTrue(
         debugtrace.last_print_string().startswith("||value <= 1 "),
         msg=debugtrace.last_print_string())
     self.func2()
示例#3
0
 def __init__(self, id: int, firstName: str, lastName: str,
              birthday: datetime.date) -> None:
     _ = debugtrace.enter(self)  # ToDo: Remove after debugging
     self.id = id
     self.firstName = firstName
     self.lastName = lastName
     self.birthday = birthday
示例#4
0
 def test_no__str__repr__(self) -> None:
     _ = debugtrace.enter()
     person = Person1('First', 'Last')
     debugtrace.print('person', person)
     self.assertTrue(
         "first_name: 'First'" in debugtrace.last_print_string())
     self.assertTrue("last_name: 'Last'" in debugtrace.last_print_string())
     self.assertTrue(
         "full_name: 'First Last'" in debugtrace.last_print_string())
示例#5
0
    def test_line_break_of_refrection(self) -> None:
        contacts = Contacts(
            Contact('Akane' , 'Apple' , date(2020, 1, 1), '080-1111-1111'),
            Contact('Yukari', 'Apple' , date(2020, 2, 2), '080-2222-2222'),
            None,
            None
        )

        _ = debugtrace.enter()
        debugtrace.print('contacts', contacts)
        self.assertTrue('{\n  contact1: (__main__.Contact){' in debugtrace.last_print_string())
        self.assertTrue('  birthday:'     in debugtrace.last_print_string())
        self.assertTrue(', first_name: '  in debugtrace.last_print_string())
        self.assertTrue('  last_name:'    in debugtrace.last_print_string())
        self.assertTrue('  phone_number:' in debugtrace.last_print_string())
        self.assertTrue('},\n  contact2: (__main__.Contact){' in debugtrace.last_print_string())
        self.assertTrue('},\n  contact3: None, contact4: None' in debugtrace.last_print_string())
示例#6
0
    def test_line_break_of_iterable(self) -> None:
        contacts = [
            Contact('Akane' , 'Apple' , date(2020, 1, 1), '080-1111-1111'),
            Contact('Yukari', 'Apple' , date(2020, 2, 2), '080-2222-2222'),
            None,
            None
        ]

        _ = debugtrace.enter()
        debugtrace.print('contacts', contacts)
        self.assertTrue('[\n  (__main__.Contact){' in debugtrace.last_print_string())
        self.assertTrue('  birthday:'     in debugtrace.last_print_string())
        self.assertTrue(', first_name: '  in debugtrace.last_print_string())
        self.assertTrue('  last_name:'    in debugtrace.last_print_string())
        self.assertTrue('  phone_number:' in debugtrace.last_print_string())
        self.assertTrue('},\n  (__main__.Contact){' in debugtrace.last_print_string())
        self.assertTrue('},\n  None, None' in debugtrace.last_print_string())
示例#7
0
 def test_indent_string(self) -> None:
     _ = debugtrace.enter()
     debugtrace.print('foo')
     self.assertRegex(debugtrace.last_print_string(),
                      '||foo \\(ini_file_test.py::[0-9]+\\)')
示例#8
0
 def func(self) -> None:
     _ = debugtrace.enter()
     self.assertRegex(debugtrace.last_print_string(),
                      '_Enter_ func \\(ini_file_test.py:[0-9]+\\)')
示例#9
0
 def test__str__repr__(self) -> None:
     _ = debugtrace.enter()
     person = Person4('First', 'Last')
     debugtrace.print('person', person)
     self.assertTrue(
         "person = repr(): First Last" in debugtrace.last_print_string())
示例#10
0
def func1():
    _ = debugtrace.enter()  # ToDo: Remove after debugging
    debugtrace.print('Hello, World!')  # ToDo: Remove after debugging
    func2()
示例#11
0
 def test_no_line_break_key_value(self) -> None:
     _ = debugtrace.enter()
     foo = {1: '000000000011111111112222222222333333333344444444445555555555'}
     debugtrace.print('foo', foo)
     self.assertTrue("  1: (length:60)'0000000000" in debugtrace.last_print_string())
示例#12
0
 def test_no_line_break_object_name_value(self) -> None:
     _ = debugtrace.enter()
     foo = Contact('000000000011111111112222222222333333333344444444445555555555', '', date(2021, 1, 1), '')
     debugtrace.print('foo', foo)
     self.assertTrue("  first_name: (length:60)'0000000000" in debugtrace.last_print_string())