def test_lookup(self): m = Mailmap() m.add_entry((b"Jane Doe", b"jane@desktop.(none)"), (None, None)) m.add_entry((b"Joe R. Developer", b"*****@*****.**"), None) m.add_entry((None, b"*****@*****.**"), (None, b"*****@*****.**")) m.add_entry((b"Some Dude", b"*****@*****.**"), (b"nick1", b"*****@*****.**")) m.add_entry( (b"Other Author", b"*****@*****.**"), (b"nick2", b"*****@*****.**"), ) m.add_entry((b"Other Author", b"*****@*****.**"), (None, b"*****@*****.**")) m.add_entry( (b"Santa Claus", b"*****@*****.**"), (None, b"*****@*****.**"), ) self.assertEqual( b"Jane Doe <jane@desktop.(none)>", m.lookup(b"Jane Doe <jane@desktop.(none)>"), ) self.assertEqual( b"Jane Doe <jane@desktop.(none)>", m.lookup(b"Jane Doe <*****@*****.**>"), ) self.assertEqual( b"Jane Doe <jane@desktop.(none)>", m.lookup(b"Jane D. <jane@desktop.(none)>"), ) self.assertEqual(b"Some Dude <*****@*****.**>", m.lookup(b"nick1 <*****@*****.**>")) self.assertEqual(b"CTO <*****@*****.**>", m.lookup(b"CTO <*****@*****.**>"))
def test_lookup(self): m = Mailmap() m.add_entry((b'Jane Doe', b'jane@desktop.(none)'), (None, None)) m.add_entry((b'Joe R. Developer', b'*****@*****.**'), None) m.add_entry((None, b'*****@*****.**'), (None, b'*****@*****.**')) m.add_entry((b'Some Dude', b'*****@*****.**'), (b'nick1', b'*****@*****.**')) m.add_entry((b'Other Author', b'*****@*****.**'), (b'nick2', b'*****@*****.**')) m.add_entry((b'Other Author', b'*****@*****.**'), (None, b'*****@*****.**')) m.add_entry((b'Santa Claus', b'*****@*****.**'), (None, b'*****@*****.**')) self.assertEqual(b'Jane Doe <jane@desktop.(none)>', m.lookup(b'Jane Doe <jane@desktop.(none)>')) self.assertEqual(b'Jane Doe <jane@desktop.(none)>', m.lookup(b'Jane Doe <*****@*****.**>')) self.assertEqual(b'Jane Doe <jane@desktop.(none)>', m.lookup(b'Jane D. <jane@desktop.(none)>')) self.assertEqual(b'Some Dude <*****@*****.**>', m.lookup(b'nick1 <*****@*****.**>')) self.assertEqual(b'CTO <*****@*****.**>', m.lookup(b'CTO <*****@*****.**>'))