Exemplo n.º 1
0
    def dict_interface(self, fixture):
        substvars = SubstvarsFile(None)
        substvars.extend([('python:Version', 'python stuff'),
                          ('reahl:Depends', 'lots of depends')])

        vassert(substvars['python:Version'] == 'python stuff')
        vassert(substvars['reahl:Depends'] == 'lots of depends')

        substvars['python:Version'] = 'other stuff'
        vassert(substvars['python:Version'] == 'other stuff')

        substvars['reahl:Goods'] = 'more goods'
        vassert(substvars['reahl:Goods'] == 'more goods')

        vassert(len(substvars) == 3)
        vassert(
            list(substvars.items())[0] == ('python:Version', 'other stuff'))
        vassert(
            list(substvars.items())[1] == ('reahl:Depends', 'lots of depends'))
        vassert(list(substvars.items())[2] == ('reahl:Goods', 'more goods'))
Exemplo n.º 2
0
def test_dict_interface():
    substvars = SubstvarsFile(None)
    substvars.extend( [('python:Version', 'python stuff'), ('reahl:Depends', 'lots of depends')] )

    assert substvars['python:Version'] == 'python stuff'
    assert substvars['reahl:Depends'] == 'lots of depends'

    substvars['python:Version'] = 'other stuff'
    assert substvars['python:Version'] == 'other stuff'

    substvars['reahl:Goods'] = 'more goods'
    assert substvars['reahl:Goods'] == 'more goods'

    assert len(substvars) == 3
    assert list(substvars.items())[0] == ('python:Version', 'other stuff')
    assert list(substvars.items())[1] == ('reahl:Depends', 'lots of depends')
    assert list(substvars.items())[2] == ('reahl:Goods', 'more goods')
Exemplo n.º 3
0
def test_reading_and_writing_substvar_files():
    raw_file = temp_file_with('')
    substvars = SubstvarsFile(raw_file.name)
    substvars.extend([('python:Version', 'python stuff'),
                      ('reahl:Depends', 'lots of depends')])

    substvars.write()

    substvars = SubstvarsFile(raw_file.name)
    assert len(substvars) == 0
    substvars.read()

    assert len(substvars) == 2
    assert list(substvars.items())[0] == ('python:Version', 'python stuff')
    assert list(substvars.items())[1] == ('reahl:Depends', 'lots of depends')
Exemplo n.º 4
0
    def reading_and_writing(self, fixture):
        raw_file = temp_file_with('')
        substvars = SubstvarsFile(raw_file.name)
        substvars.extend([('python:Version', 'python stuff'),
                          ('reahl:Depends', 'lots of depends')])

        substvars.write()

        substvars = SubstvarsFile(raw_file.name)
        vassert(len(substvars) == 0)
        substvars.read()

        vassert(len(substvars) == 2)
        vassert(
            list(substvars.items())[0] == ('python:Version', 'python stuff'))
        vassert(
            list(substvars.items())[1] == ('reahl:Depends', 'lots of depends'))