def test_fields_str_ignore_none(): Foo = namedtuple('Foo', 'bar') to_str = common.fields_str('Foo', ('bar', ), False) assert to_str(Foo(42)) == ('Foo({%r: 42})' % 'bar') assert to_str(Foo(None)) == 'Foo({})'
def test_fields_str_ignore_none(): Foo = namedtuple('Foo', 'bar') to_str = common.fields_str('Foo', ('bar',), False) assert to_str(Foo(42)) == ('Foo({%r: 42})' % 'bar') assert to_str(Foo(None)) == 'Foo({})'
def test_fields_str(): Foo = namedtuple('Foo', 'bar') to_str = common.fields_str('Foo', ('bar', )) assert to_str(Foo(42)) == ('Foo({%r: 42})' % 'bar') assert to_str(Foo(None)) == ('Foo({%r: None})' % 'bar')
def test_fields_str(): Foo = namedtuple('Foo', 'bar') to_str = common.fields_str('Foo', ('bar',)) assert to_str(Foo(42)) == ('Foo({%r: 42})' % 'bar') assert to_str(Foo(None)) == ('Foo({%r: None})' % 'bar')