def test_summary(): rock = Component(r) s = rock.summary(fmt="My rock: {lithology} ({colour}, {grainsize!u})") assert s == 'My rock: sand (grey, VF-F)' rock6 = Component(r6) s = rock6.summary(fmt="My rock: {lithology}") assert s == 'My rock: _' empty = Component({}) d = "String" assert not empty # Should have False value assert empty.summary(default=d) == d
def test_summary(): """ Test ability to generate summaries. """ rock = Component(r) s = rock.summary(fmt="My rock: {lithology} ({colour}, {grainsize!u})") assert s == 'My rock: sand (grey, VF-F)' rock6 = Component(r6) s = rock6.summary(fmt="My rock: {lithology}") assert s == 'My rock: _' empty = Component({}) d = "String" assert not empty # Should have False value assert empty.summary(default=d) == d
def test_summary(): rock = Component(r) s = rock.summary(fmt="My rock: {lithology} ({colour}, {GRAINSIZE})") assert s == 'My rock: sand (grey, VF-F)' rock6 = Component(r6) s = rock6.summary(fmt="My rock: {lithology}") assert s == 'My rock: ' empty = Component({}) d = "String" assert not empty # Should have False value assert empty.summary(default=d) == d with pytest.raises(ComponentError): rock.summary(fmt="My rock: {not there}")