def test_geom_basics(): # mock the validd aes and get the geom to accept the color # mapping -> only subclasses normally declare which aes mappings # are valid and geom.DEFAULT_AES is a empty list geom.DEFAULT_AES = {"color": None} g = geom(data=meat) assert_is(meat, g.data) g = geom(meat) assert_is(meat, g.data) g = geom(aes(color="beef")) assert_equal("beef", g.aes["color"]) g = geom(mapping=aes(color="pork")) assert_equal("pork", g.aes["color"]) with assert_raises(Exception): g = geom(aes(color="beef"), mapping=aes(color="pork")) assert_equal("pork", g.aes["color"]) # setting, not mapping g = geom(color="blue") assert_equal("blue", g.manual_aes["color"])
def test_geom_basics(): # mock the validd aes and get the geom to accept the color # mapping -> only subclasses normally declare which aes mappings # are valid and geom.VALID_AES is a empty list geom.VALID_AES = ["color"] g = geom(data=meat) assert_is(meat, g.data) g = geom(meat) assert_is(meat, g.data) g = geom(aes(color="beef")) assert_equal("beef", g.aes["color"]) g = geom(mapping=aes(color="pork")) assert_equal("pork", g.aes["color"]) # It would probably be better to throw an exception if # two aes are given... g = geom(aes(color="beef"), mapping=aes(color="pork")) assert_equal("pork", g.aes["color"]) # setting, not mapping g = geom(color="blue") assert_equal("blue", g.manual_aes["color"])