def test_init(self): with pytest.raises(OmeroTablesFeatureStore.FeatureRowException): OmeroTablesFeatureStore.FeatureRow(names=['a'], values=[1, 2]) fr = OmeroTablesFeatureStore.FeatureRow(names=['a', 'b'], values=[1, 2]) assert fr.names == ['a', 'b'] assert fr.values == [1, 2] fr = OmeroTablesFeatureStore.FeatureRow(names=['a', 'b']) assert fr.names == ['a', 'b'] assert fr.values is None
def test_repr(self): fr = OmeroTablesFeatureStore.FeatureRow(names=['a'], values=[1], infonames=['ma'], infovalues=[0]) assert repr(fr) == ("FeatureRow(names=['a'], values=[1], " "infonames=['ma'], infovalues=[0])")
def test_infovalues(self): fr = OmeroTablesFeatureStore.FeatureRow(names=['a', 'b'], infonames=['ma', 'mb']) with pytest.raises(OmeroTablesFeatureStore.FeatureRowException): fr.infovalues = ['va'] fr.infovalues = ['x', 'y'] assert fr._get_index('ma') == (0, True) assert fr._get_index('mb') == (1, True) fr['ma'] = 'z' assert fr.infovalues == ['z', 'y']
def test_values(self): fr = OmeroTablesFeatureStore.FeatureRow(names=['a', 'b']) fr.values = [1, 2] assert fr.values == [1, 2] with pytest.raises(OmeroTablesFeatureStore.FeatureRowException): fr.values = [0, 0, 0] assert fr._get_index('a') == (0, False) assert fr._get_index('b') == (1, False) assert fr['a'] == 1 assert fr['b'] == 2 fr['a'] = 10 assert fr.values == [10, 2] with pytest.raises(KeyError): fr['c'] = [0] fr = OmeroTablesFeatureStore.FeatureRow(values=[1, 2]) with pytest.raises(OmeroTablesFeatureStore.FeatureRowException): fr.values = [0, 0, 0]